"+e[h].substring(0,4)+" | "),b.push(""+e[h].split("Title>")[1].split("")[0]+" | ");b.push("
"); +if (ptPre >= 0) this.line = this.line.substring(ptPre + 5); +var intTableNo = this.parseIntStr(this.line); +if (intTableNo == 0) { +this.setSpaceGroupName(this.line.substring(2)); +} else { +while (intTableNo < 0 && this.rdLine() != null) intTableNo = this.parseIntStr(this.line); + +this.setSpaceGroupName("" + intTableNo); +}var data = Clazz.newFloatArray (6, 0); +this.fillFloatArray(this.rdLine(), 0, data); +for (var i = 0; i < 6; i++) this.setUnitCellItem(i, data[i]); + +this.i0 = this.asc.ac; +this.nAtoms = this.parseIntStr(this.rdLine()); +for (var i = this.nAtoms; --i >= 0; ) { +var tokens = JU.PT.getTokens(this.rdLine()); +if (!this.getSym && tokens[1].contains("_")) continue; +if (tokens.length == 3) this.addAtomXYZSymName(tokens, 0, "Be", "Be1"); + else this.addAtomXYZSymName(tokens, 3, tokens[0], tokens[0] + tokens[1]); +} +if (Float.isNaN(fAmp)) { +if (ptPre >= 0) this.applySymmetryAndSetTrajectory(); +return; +}this.line = null; +this.readDisplacements(fAmp); +}, "~S,~N"); +Clazz.defineMethod(c$, "setSpaceGroupName", +function(name){ +if (!this.ignoreFileSpaceGroupName) { +name = "bilbao:" + name; +} else if (this.sgName.startsWith(":")) { +var pt = name.indexOf(':'); +if (pt < 0) pt = name.length; +name = name.substring(0, pt); +var s = this.htParams.get("loadScript"); +if (s != null) { +pt = s.indexOf("spacegroup \":"); +if (pt > 0) s.insert(pt + 12, name); +}name += this.sgName; +this.ignoreFileSpaceGroupName = false; +}Clazz.superCall(this, J.adapter.readers.xtal.BilbaoReader, "setSpaceGroupName", [name]); +}, "~S"); +Clazz.defineMethod(c$, "readDisplacements", +function(fAmp){ +for (var i = 0; i < this.nAtoms; i++) { +if (this.line == null) this.rdLine(); +var tokens = JU.PT.split(this.line, "x|x"); +if (this.getSym || !tokens[0].contains("_")) this.asc.atoms[this.i0 + i].vib = JU.V3.new3(this.parseFloatStr(tokens[1]), this.parseFloatStr(tokens[2]), this.parseFloatStr(tokens[3])); +this.line = null; +} +this.applySymmetryAndSetTrajectory(); +for (var i = this.asc.ac; --i >= this.i0; ) { +var a = this.asc.atoms[i]; +if (a.vib != null) { +var v = new JU.Vibration(); +v.setT(a.vib); +a.vib = v; +this.asc.getSymmetry().toCartesian(v, true); +v.scale(1 / fAmp); +}} +this.appendLoadNote((this.asc.ac - this.i0) + " displacements"); +}, "~N"); +Clazz.defineMethod(c$, "setTitle", +function(title){ +if (title != null) { +this.asc.setAtomSetName(title); +this.appendLoadNote(title); +}}, "~S"); +Clazz.defineMethod(c$, "rdLine", +function(){ +while (this.rd() != null && (this.line.trim().length == 0 || this.checkComment())) { +} +return this.line; +}); +Clazz.defineMethod(c$, "readVirtual", +function(){ +if (this.line.contains("K-vector:")) this.kvec = this.line.substring(this.line.indexOf("("), this.line.indexOf(")") + 1); +var s = this.getLinesUntil("\"BCS\""); +var pt = s.indexOf("The amplitude"); +pt = s.indexOf("=", pt); +var amp = s.substring(pt + 2, s.indexOf(" ", pt + 2)); +var fAmp = (this.normDispl ? this.parseFloatStr(amp) : 1); +var irrep = this.getAttr(s, "irrep"); +if (irrep.indexOf(":") >= 0) irrep = irrep.substring(0, irrep.indexOf(":")); +this.line = this.line.substring(this.line.indexOf("value=") + 7); +this.readBilbaoFormat(this.kvec + " " + irrep + " (" + amp + " Ang.)", fAmp); +}); +Clazz.defineMethod(c$, "getAttr", +function(s, key){ +var pt = s.indexOf("value", s.indexOf("\"" + key + "\"")); +s = JU.PT.getQuotedStringAt(s, pt); +s = JU.PT.rep(s, "", ""); +s = JU.PT.rep(s, "", ""); +return s.trim(); +}, "~S,~S"); +Clazz.defineMethod(c$, "getLinesUntil", +function(key){ +var sb = new JU.SB(); +do { +sb.append(this.line); +} while (!this.rd().contains(key)); +return sb.toString(); +}, "~S"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/CastepReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/CastepReader.js new file mode 100755 index 000000000000..aecc1ef6369e --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/CastepReader.js @@ -0,0 +1,520 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.xtal.CastepReader", ["JU.DF", "$.Lst", "$.M4", "$.P3", "$.PT", "$.V3", "J.adapter.smarter.Atom", "JU.Escape", "$.Logger", "$.Tensor"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.tokens = null; +this.isPhonon = false; +this.isTS = false; +this.isOutput = false; +this.isCell = false; +this.a = 0; +this.b = 0; +this.c = 0; +this.alpha = 0; +this.beta = 0; +this.gamma = 0; +this.abc = null; +this.ac = 0; +this.atomPts = null; +this.havePhonons = false; +this.lastQPt = null; +this.qpt2 = 0; +this.desiredQpt = null; +this.desiredQ = null; +this.chargeType = "MULL"; +this.isAllQ = false; +this.haveCharges = false; +this.tsType = null; +this.matSupercell = null; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "CastepReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.prepareFields (c$, function(){ +this.abc = new Array(3); +}); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +if (this.filter != null) { +this.chargeType = this.getFilter("CHARGE="); +if (this.chargeType != null && this.chargeType.length > 4) this.chargeType = this.chargeType.substring(0, 4); +this.filter = this.filter.$replace('(', '{').$replace(')', '}'); +this.filter = JU.PT.rep(this.filter, " ", " "); +this.isAllQ = this.checkFilterKey("Q=ALL"); +this.tsType = this.getFilter("TSTYPE="); +if (!this.isAllQ && this.filter.indexOf("{") >= 0) this.setDesiredQpt(this.filter.substring(this.filter.indexOf("{"))); +this.filter = JU.PT.rep(this.filter, "-PT", ""); +}this.continuing = this.readFileData(); +}); +Clazz.defineMethod(c$, "setDesiredQpt", +function(s){ +this.desiredQpt = new JU.V3(); +this.desiredQ = ""; +var num = 1; +var denom = 1; +var ipt = 0; +var xyz = 0; +var useSpace = (s.indexOf(',') < 0); +for (var i = 0; i < s.length; i++) { +var c = s.charAt(i); +switch ((c).charCodeAt(0)) { +case 123: +ipt = i + 1; +num = 1; +denom = 1; +break; +case 47: +num = this.parseFloatStr(s.substring(ipt, i)); +ipt = i + 1; +denom = 0; +break; +case 44: +case 32: +case 125: +if (c == '}') this.desiredQ = s.substring(0, i + 1); + else if ((c == ' ') != useSpace) break; +if (denom == 0) { +denom = this.parseFloatStr(s.substring(ipt, i)); +} else { +num = this.parseFloatStr(s.substring(ipt, i)); +}num /= denom; +switch (xyz++) { +case 0: +this.desiredQpt.x = num; +break; +case 1: +this.desiredQpt.y = num; +break; +case 2: +this.desiredQpt.z = num; +break; +} +denom = 1; +if (c == '}') i = s.length; +ipt = i + 1; +break; +} +} +JU.Logger.info("Looking for q-pt=" + this.desiredQpt); +}, "~S"); +Clazz.defineMethod(c$, "readFileData", +function(){ +while (this.tokenizeCastepCell() > 0) if (this.tokens.length >= 2 && this.tokens[0].equalsIgnoreCase("%BLOCK")) { +JU.Logger.info(this.line); +if (this.tokens[1].equalsIgnoreCase("LATTICE_ABC")) { +this.readLatticeAbc(); +continue; +}if (this.tokens[1].equalsIgnoreCase("LATTICE_CART")) { +this.readLatticeCart(); +continue; +}if (this.tokens[1].equalsIgnoreCase("POSITIONS_FRAC")) { +this.setFractionalCoordinates(true); +this.readPositionsFrac(); +continue; +}if (this.tokens[1].equalsIgnoreCase("POSITIONS_ABS")) { +this.setFractionalCoordinates(false); +this.readPositionsAbs(); +continue; +}} +if (this.isPhonon || this.isOutput || this.isTS) { +if (this.isPhonon) { +this.isTrajectory = (this.desiredVibrationNumber <= 0); +this.asc.allowMultiple = false; +}return true; +}return false; +}); +Clazz.overrideMethod(c$, "checkLine", +function(){ +if (this.isOutput) { +if (this.line.contains("Real Lattice(A)")) { +this.readOutputUnitCell(); +} else if (this.line.contains("Fractional coordinates of atoms")) { +if (this.doGetModel(++this.modelNumber, null)) { +this.readOutputAtoms(); +}} else if (this.doProcessLines && (this.line.contains("Atomic Populations (Mulliken)") || this.line.contains("Hirshfield Charge (e)"))) { +this.readOutputCharges(); +} else if (this.doProcessLines && this.line.contains("Born Effective Charges")) { +this.readOutputBornChargeTensors(); +} else if (this.line.contains("Final energy ")) { +this.readEnergy(3, null); +} else if (this.line.contains("Dispersion corrected final energy*")) { +this.readEnergy(5, null); +} else if (this.line.contains("Total energy corrected")) { +this.readEnergy(8, null); +}return true; +}if (this.line.contains("<-- E")) { +this.readPhononTrajectories(); +return true; +}if (this.line.indexOf("Unit cell vectors") == 1) { +this.readPhononUnitCell(); +return true; +}if (this.line.indexOf("Fractional Co-ordinates") >= 0) { +this.readPhononFractionalCoord(); +return true; +}if (this.line.indexOf("q-pt") >= 0) { +this.readPhononFrequencies(); +return true; +}return true; +}); +Clazz.defineMethod(c$, "readOutputUnitCell", +function(){ +this.applySymmetryAndSetTrajectory(); +this.asc.newAtomSetClear(false); +this.setFractionalCoordinates(true); +this.abc = this.read3Vectors(false); +this.setLatticeVectors(); +}); +Clazz.defineMethod(c$, "readOutputAtoms", +function(){ +this.readLines(2); +while (this.rd().indexOf("xxx") < 0) { +var atom = new J.adapter.smarter.Atom(); +this.tokens = this.getTokens(); +atom.elementSymbol = this.tokens[1]; +atom.atomName = this.tokens[1] + this.tokens[2]; +this.asc.addAtomWithMappedName(atom); +this.setAtomCoordTokens(atom, this.tokens, 3); +} +}); +Clazz.defineMethod(c$, "readEnergy", +function(pt, prefix){ +if (this.isTrajectory) this.applySymmetryAndSetTrajectory(); +this.tokens = this.getTokens(); +try { +var energy = Double.$valueOf(Double.parseDouble(this.tokens[pt])); +this.asc.setAtomSetName(prefix + "Energy = " + energy + " eV"); +this.asc.setAtomSetEnergy("" + energy, energy.floatValue()); +this.asc.setCurrentModelInfo("Energy", energy); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +this.appendLoadNote("CASTEP Energy could not be read: " + this.line); +} else { +throw e; +} +} +}, "~N,~S"); +Clazz.defineMethod(c$, "readPhononTrajectories", +function(){ +if (!this.isTS) this.isTrajectory = (this.desiredVibrationNumber <= 0); +if (this.isTrajectory) this.asc.setTrajectory(); +this.doApplySymmetry = true; +while (this.line != null && this.line.contains("<-- E")) { +var skip = (this.isTS && this.tsType != null && this.prevline.indexOf(this.tsType) < 0); +if (!skip) { +this.asc.newAtomSetClear(false); +if (this.isTS) this.readEnergy(0, JU.PT.getTokens(this.prevline + " -")[0] + " "); +this.discardLinesUntilContains("<-- h"); +this.setSpaceGroupName("P1"); +this.abc = this.read3Vectors(true); +this.setLatticeVectors(); +this.setFractionalCoordinates(false); +this.discardLinesUntilContains("<-- R"); +while (this.line != null && this.line.contains("<-- R")) { +this.tokens = this.getTokens(); +this.setAtomCoordScaled(null, this.tokens, 2, 0.5291772).elementSymbol = this.tokens[0]; +this.rd(); +} +this.applySymmetryAndSetTrajectory(); +}this.discardLinesUntilContains("<-- E"); +} +}); +Clazz.overrideMethod(c$, "finalizeSubclassReader", +function(){ +if (this.isPhonon || this.isOutput || this.isTS) { +this.isTrajectory = false; +} else { +this.doApplySymmetry = true; +this.setLatticeVectors(); +var nAtoms = this.asc.ac; +for (var i = 0; i < nAtoms; i++) this.setAtomCoord(this.asc.atoms[i]); + +}this.finalizeReaderASCR(); +}); +Clazz.defineMethod(c$, "setLatticeVectors", +function(){ +if (this.abc[0] == null) { +this.setUnitCell(this.a, this.b, this.c, this.alpha, this.beta, this.gamma); +return; +}var lv = Clazz.newFloatArray (3, 0); +for (var i = 0; i < 3; i++) { +lv[0] = this.abc[i].x; +lv[1] = this.abc[i].y; +lv[2] = this.abc[i].z; +this.addExplicitLatticeVector(i, lv, 0); +} +}); +Clazz.defineMethod(c$, "readLatticeAbc", +function(){ +if (this.tokenizeCastepCell() == 0) return; +var factor = this.readLengthUnit(this.tokens[0]); +if (this.tokens.length >= 3) { +this.a = this.parseFloatStr(this.tokens[0]) * factor; +this.b = this.parseFloatStr(this.tokens[1]) * factor; +this.c = this.parseFloatStr(this.tokens[2]) * factor; +} else { +JU.Logger.warn("error reading a,b,c in %BLOCK LATTICE_ABC in CASTEP .cell file"); +return; +}if (this.tokenizeCastepCell() == 0) return; +if (this.tokens.length >= 3) { +this.alpha = this.parseFloatStr(this.tokens[0]); +this.beta = this.parseFloatStr(this.tokens[1]); +this.gamma = this.parseFloatStr(this.tokens[2]); +} else { +JU.Logger.warn("error reading alpha,beta,gamma in %BLOCK LATTICE_ABC in CASTEP .cell file"); +}}); +Clazz.defineMethod(c$, "readLatticeCart", +function(){ +if (this.tokenizeCastepCell() == 0) return; +var factor = this.readLengthUnit(this.tokens[0]); +var x; +var y; +var z; +for (var i = 0; i < 3; i++) { +if (this.tokens.length >= 3) { +x = this.parseFloatStr(this.tokens[0]) * factor; +y = this.parseFloatStr(this.tokens[1]) * factor; +z = this.parseFloatStr(this.tokens[2]) * factor; +this.abc[i] = JU.V3.new3(x, y, z); +} else { +JU.Logger.warn("error reading coordinates of lattice vector " + Integer.toString(i + 1) + " in %BLOCK LATTICE_CART in CASTEP .cell file"); +return; +}if (this.tokenizeCastepCell() == 0) return; +} +this.a = this.abc[0].length(); +this.b = this.abc[1].length(); +this.c = this.abc[2].length(); +this.alpha = (this.abc[1].angle(this.abc[2]) * 57.29577951308232); +this.beta = (this.abc[2].angle(this.abc[0]) * 57.29577951308232); +this.gamma = (this.abc[0].angle(this.abc[1]) * 57.29577951308232); +}); +Clazz.defineMethod(c$, "readPositionsFrac", +function(){ +if (this.tokenizeCastepCell() == 0) return; +this.readAtomData(1.0); +}); +Clazz.defineMethod(c$, "readPositionsAbs", +function(){ +if (this.tokenizeCastepCell() == 0) return; +var factor = this.readLengthUnit(this.tokens[0]); +this.readAtomData(factor); +}); +Clazz.defineMethod(c$, "readLengthUnit", +function(units){ +var factor = 1.0; +for (var i = 0; i < J.adapter.readers.xtal.CastepReader.lengthUnitIds.length; i++) if (units.equalsIgnoreCase(J.adapter.readers.xtal.CastepReader.lengthUnitIds[i])) { +factor = J.adapter.readers.xtal.CastepReader.lengthUnitFactors[i]; +this.tokenizeCastepCell(); +break; +} +return factor; +}, "~S"); +Clazz.defineMethod(c$, "readAtomData", +function(factor){ +do { +if (this.tokens.length >= 4) { +var atom = this.asc.addNewAtom(); +var pt = this.tokens[0].indexOf(":"); +if (pt >= 0) { +atom.elementSymbol = this.tokens[0].substring(0, pt); +atom.atomName = this.tokens[0]; +} else { +atom.elementSymbol = this.tokens[0]; +}atom.set(this.parseFloatStr(this.tokens[1]), this.parseFloatStr(this.tokens[2]), this.parseFloatStr(this.tokens[3])); +atom.scale(factor); +} else { +JU.Logger.warn("cannot read line with CASTEP atom data: " + this.line); +}} while (this.tokenizeCastepCell() > 0 && !this.tokens[0].equalsIgnoreCase("%ENDBLOCK")); +}, "~N"); +Clazz.defineMethod(c$, "tokenizeCastepCell", +function(){ +while (this.rd() != null) { +if ((this.line = this.line.trim()).length == 0 || this.line.startsWith("#") || this.line.startsWith("!")) continue; +if (!this.isCell) { +if (this.line.startsWith("%")) { +this.isCell = true; +break; +}if (this.line.startsWith("LST")) { +this.isTS = true; +JU.Logger.info("reading CASTEP .ts file"); +return -1; +}if (this.line.startsWith("BEGIN header")) { +this.isPhonon = true; +JU.Logger.info("reading CASTEP .phonon file"); +return -1; +}if (this.line.contains("CASTEP")) { +this.isOutput = true; +JU.Logger.info("reading CASTEP .castep file"); +return -1; +}}break; +} +return (this.line == null ? 0 : (this.tokens = this.getTokens()).length); +}); +Clazz.defineMethod(c$, "readOutputBornChargeTensors", +function(){ +if (this.rd().indexOf("--------") < 0) return; +var atoms = this.asc.atoms; +this.appendLoadNote("Ellipsoids: Born Charge Tensors"); +while (this.rd().indexOf('=') < 0) this.getTensor(atoms[this.readOutputAtomIndex()], this.line.substring(12)); + +}); +Clazz.defineMethod(c$, "readOutputAtomIndex", +function(){ +this.tokens = this.getTokens(); +return this.asc.getAtomIndex(this.tokens[0] + this.tokens[1]); +}); +Clazz.defineMethod(c$, "getTensor", +function(atom, line0){ +var data = Clazz.newFloatArray (9, 0); +var a = Clazz.newDoubleArray (3, 3, 0); +this.fillFloatArray(line0, 0, data); +JU.Logger.info("tensor " + atom.atomName + "\t" + JU.Escape.eAF(data)); +for (var p = 0, i = 0; i < 3; i++) for (var j = 0; j < 3; j++) a[i][j] = data[p++]; + + +atom.addTensor(( new JU.Tensor()).setFromAsymmetricTensor(a, "charge", atom.atomName + " " + line0), null, false); +if (!this.haveCharges) this.appendLoadNote("Ellipsoids set \"charge\": Born Effective Charges"); +this.haveCharges = true; +}, "J.adapter.smarter.Atom,~S"); +Clazz.defineMethod(c$, "readOutputCharges", +function(){ +if (this.line.toUpperCase().indexOf(this.chargeType) < 0) return; +JU.Logger.info("reading charges: " + this.line); +this.readLines(2); +var haveSpin = (this.line.indexOf("Spin") >= 0); +this.rd(); +var atoms = this.asc.atoms; +var spins = (haveSpin ? Clazz.newFloatArray (atoms.length, 0) : null); +if (spins != null) for (var i = 0; i < spins.length; i++) spins[i] = 0; + +while (this.rd() != null && this.line.indexOf('=') < 0) { +var index = this.readOutputAtomIndex(); +var charge = this.parseFloatStr(this.tokens[haveSpin ? this.tokens.length - 2 : this.tokens.length - 1]); +atoms[index].partialCharge = charge; +if (haveSpin) spins[index] = this.parseFloatStr(this.tokens[this.tokens.length - 1]); +} +if (haveSpin) this.asc.setAtomProperties("spin", spins, -1, false); +}); +Clazz.defineMethod(c$, "readPhononUnitCell", +function(){ +this.abc = this.read3Vectors(this.line.indexOf("bohr") >= 0); +this.setSpaceGroupName("P1"); +this.setLatticeVectors(); +}); +Clazz.defineMethod(c$, "readPhononFractionalCoord", +function(){ +this.setFractionalCoordinates(true); +while (this.rd() != null && this.line.indexOf("END") < 0) { +this.tokens = this.getTokens(); +this.addAtomXYZSymName(this.tokens, 1, this.tokens[4], null).bfactor = this.parseFloatStr(this.tokens[5]); +} +this.ac = this.asc.ac; +this.atomPts = new Array(this.ac); +var atoms = this.asc.atoms; +for (var i = 0; i < this.ac; i++) this.atomPts[i] = JU.P3.newP(atoms[i]); + +}); +Clazz.defineMethod(c$, "readPhononFrequencies", +function(){ +this.tokens = this.getTokens(); +var v = new JU.V3(); +var qvec = JU.V3.new3(this.parseFloatStr(this.tokens[2]), this.parseFloatStr(this.tokens[3]), this.parseFloatStr(this.tokens[4])); +var fcoord = this.getFractionalCoord(qvec); +var qtoks = "{" + this.tokens[2] + " " + this.tokens[3] + " " + this.tokens[4] + "}"; +if (fcoord == null) fcoord = qtoks; + else fcoord = "{" + fcoord + "}"; +var isOK = this.isAllQ; +var isSecond = (this.tokens[1].equals(this.lastQPt)); +this.qpt2 = (isSecond ? this.qpt2 + 1 : 1); +this.lastQPt = this.tokens[1]; +if (!isOK && this.checkFilterKey("Q=")) { +if (this.desiredQpt != null) { +v.sub2(this.desiredQpt, qvec); +if (v.length() < 0.001) fcoord = this.desiredQ; +}isOK = (this.checkFilterKey("Q=" + fcoord + "." + this.qpt2 + ";") || this.checkFilterKey("Q=" + this.lastQPt + "." + this.qpt2 + ";") || !isSecond && this.checkFilterKey("Q=" + fcoord + ";") || !isSecond && this.checkFilterKey("Q=" + this.lastQPt + ";")); +if (!isOK) return; +}var isGammaPoint = (qvec.length() == 0); +var nx = 1; +var ny = 1; +var nz = 1; +if (this.ptSupercell != null && !isOK && !isSecond) { +this.matSupercell = new JU.M4(); +this.matSupercell.m00 = this.ptSupercell.x; +this.matSupercell.m11 = this.ptSupercell.y; +this.matSupercell.m22 = this.ptSupercell.z; +this.matSupercell.m33 = 1; +JU.Logger.info("Using supercell \n" + this.matSupercell); +nx = this.ptSupercell.x; +ny = this.ptSupercell.y; +nz = this.ptSupercell.z; +var dx = (qvec.x == 0 ? 1 : qvec.x) * nx; +var dy = (qvec.y == 0 ? 1 : qvec.y) * ny; +var dz = (qvec.z == 0 ? 1 : qvec.z) * nz; +if ((nx != 1 || ny != 1 || nz != 1) && isGammaPoint || !J.adapter.readers.xtal.CastepReader.isInt(dx) || !J.adapter.readers.xtal.CastepReader.isInt(dy) || !J.adapter.readers.xtal.CastepReader.isInt(dz)) return; +isOK = true; +}if (this.ptSupercell == null || !this.havePhonons) this.appendLoadNote(this.line); +if (!isOK && isSecond) return; +if (!isOK && (this.ptSupercell == null) == !isGammaPoint) return; +if (this.havePhonons && !this.isAllQ) return; +this.havePhonons = true; +var qname = "q=" + this.lastQPt + " " + fcoord; +this.applySymmetryAndSetTrajectory(); +if (isGammaPoint) qvec = null; +var freqs = new JU.Lst(); +while (this.rd() != null && this.line.indexOf("Phonon") < 0) { +this.tokens = this.getTokens(); +freqs.addLast(Float.$valueOf(this.parseFloatStr(this.tokens[1]))); +} +this.rd(); +var frequencyCount = freqs.size(); +var data = Clazz.newFloatArray (8, 0); +var t = new JU.V3(); +this.asc.setCollectionName(qname); +for (var i = 0; i < frequencyCount; i++) { +if (!this.doGetVibration(++this.vibrationNumber)) { +for (var j = 0; j < this.ac; j++) this.rd(); + +continue; +}if (this.desiredVibrationNumber <= 0) { +if (!this.isTrajectory) { +this.cloneLastAtomSet(this.ac, this.atomPts); +this.applySymmetryAndSetTrajectory(); +}}this.symmetry = this.asc.getSymmetry(); +var iatom = this.asc.getLastAtomSetAtomIndex(); +var freq = freqs.get(i).floatValue(); +var atoms = this.asc.atoms; +var aCount = this.asc.ac; +for (var j = 0; j < this.ac; j++) { +this.fillFloatArray(null, 0, data); +for (var k = iatom++; k < aCount; k++) if (atoms[k].atomSite == j) { +t.sub2(atoms[k], atoms[atoms[k].atomSite]); +if (this.matSupercell != null) this.matSupercell.rotTrans(t); +this.setPhononVector(data, atoms[k], t, qvec, v); +this.asc.addVibrationVectorWithSymmetry(k, v.x, v.y, v.z, true); +} +} +if (this.isTrajectory) this.asc.setTrajectory(); +this.asc.setAtomSetFrequency(this.vibrationNumber, null, null, "" + freq, null); +this.asc.setAtomSetName(JU.DF.formatDecimal(freq, 2) + " cm-1 " + qname); +} +}); +Clazz.defineMethod(c$, "getFractionalCoord", +function(qvec){ +return (this.symmetry != null && J.adapter.readers.xtal.CastepReader.isInt(qvec.x * 12) && J.adapter.readers.xtal.CastepReader.isInt(qvec.y * 12) && J.adapter.readers.xtal.CastepReader.isInt(qvec.z * 12) ? this.symmetry.fcoord(qvec) : null); +}, "JU.V3"); +c$.isInt = Clazz.defineMethod(c$, "isInt", +function(f){ +return (Math.abs(f - Math.round(f)) < 0.001); +}, "~N"); +Clazz.defineMethod(c$, "setPhononVector", +function(data, atom, rTrans, qvec, v){ +if (qvec == null) { +v.set(data[2], data[4], data[6]); +} else { +var phase = qvec.dot(rTrans); +var cosph = Math.cos(6.283185307179586 * phase); +var sinph = Math.sin(6.283185307179586 * phase); +v.x = (cosph * data[2] - sinph * data[3]); +v.y = (cosph * data[4] - sinph * data[5]); +v.z = (cosph * data[6] - sinph * data[7]); +}v.scale(Math.sqrt(1 / atom.bfactor)); +}, "~A,J.adapter.smarter.Atom,JU.V3,JU.V3,JU.V3"); +c$.lengthUnitIds = Clazz.newArray(-1, ["bohr", "m", "cm", "nm", "ang", "a0"]); +c$.lengthUnitFactors = Clazz.newFloatArray(-1, [0.5291772, 1E10, 1E8, 1E1, 1.0, 0.5291772]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/CgdReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/CgdReader.js new file mode 100755 index 000000000000..41f3478a2f83 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/CgdReader.js @@ -0,0 +1,163 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader", "JU.V3"], "J.adapter.readers.xtal.CgdReader", ["java.util.Hashtable", "JU.Lst", "$.M3", "$.P3", "$.PT", "J.adapter.smarter.Bond", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.noBondSym = false; +this.tokens = null; +this.htEdges = null; +this.lastName = null; +this.edgeData = null; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "CgdReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.setFractionalCoordinates(true); +this.asc.setNoAutoBond(); +this.asc.vibScale = 1; +this.forceSymmetry(!this.noPack); +this.noBondSym = this.checkFilterKey("NOBONDSYM"); +}); +Clazz.overrideMethod(c$, "checkLine", +function(){ +this.line = this.line.trim(); +if (this.line.length == 0 || this.line.startsWith("#")) return true; +if (!Character.isLetter(this.line.charAt(0))) this.line = this.lastName + " " + this.line; +this.tokens = this.getTokens(); +if (this.tokens.length > 0) { +this.lastName = this.tokens[0].toUpperCase(); +var pt = "NAME |CELL |GROUP|ATOM |EDGE |".indexOf(this.lastName); +if (this.tokens.length > 1 && (pt == 0 || this.doProcessLines)) switch (pt) { +case 0: +if (!this.doGetModel(++this.modelNumber, null)) return this.checkLastModel(); +this.applySymmetryAndSetTrajectory(); +this.setFractionalCoordinates(true); +this.asc.newAtomSet(); +this.asc.setAtomSetName(this.line.substring(6).trim()); +this.htEdges = null; +this.edgeData = null; +break; +case 6: +for (var i = 0; i < 6; i++) this.setUnitCellItem(i, (i < 3 ? 10 : 1) * this.parseFloatStr(this.tokens[i + 1])); + +break; +case 12: +this.setSpaceGroupName("bilbao:" + this.group(this.tokens[1])); +break; +case 18: +this.atom(); +break; +case 24: +if (!this.doApplySymmetry) break; +if (this.edgeData == null) this.edgeData = new JU.Lst(); +this.edgeData.addLast(this.line); +break; +} +}return true; +}); +Clazz.defineMethod(c$, "group", +function(name){ +var name0 = null; +if (name.charAt(0) == '"') name = name.substring(1, name.length - 1); +var pt = ";P2=P121;P21=P1211;C2=C121;A2=A121;I2=I121;Pm=P1m1;Pc=P1c1;Pn=P1n1;Pa=P1a1;Cm=C1m1;Am=A1m1;Im=I1m1;Cc=C1c1;An=A1n1;Ia=I1a1;Aa=A1a1;Cn=C1n1;Ic=I1c1;P2/m=P12/m1;P21/m=P121/m1;C2/m=C12/m1;A2/m=A12/m1;I2/m=I12/m1;P2/c=P12/c1;P2/n=P12/n1;P2/a=P12/a1;P21/c=P121/c1;P21/n=P121/n1;P21/a=P121/a1;C2/c=C12/c1;A2/n=A12/n1;I2/a=I12/a1;A2/a=A12/a1;C2/n=C12/n1;I2/c=I12/c1;Pm3=Pm-3;Pn3=Pn-3;Fm3=Fm-3;Fd3=Fd-3;Im3=Im-3;Pa3=Pa-3;Ia3=Ia-3;Pm3m=Pm-3m;Pn3n=Pn-3n;Pm3n=Pm-3n;Pn3m=Pn-3m;Fm3m=Fm-3m;Fm3c=Fm-3c;Fd3m=Fd-3m;Fd3c=Fd-3c;Im3m=Im-3m;Ia3d=Ia-3d;".indexOf(";" + name + "="); +if (pt >= 0) { +name0 = name; +name = ";P2=P121;P21=P1211;C2=C121;A2=A121;I2=I121;Pm=P1m1;Pc=P1c1;Pn=P1n1;Pa=P1a1;Cm=C1m1;Am=A1m1;Im=I1m1;Cc=C1c1;An=A1n1;Ia=I1a1;Aa=A1a1;Cn=C1n1;Ic=I1c1;P2/m=P12/m1;P21/m=P121/m1;C2/m=C12/m1;A2/m=A12/m1;I2/m=I12/m1;P2/c=P12/c1;P2/n=P12/n1;P2/a=P12/a1;P21/c=P121/c1;P21/n=P121/n1;P21/a=P121/a1;C2/c=C12/c1;A2/n=A12/n1;I2/a=I12/a1;A2/a=A12/a1;C2/n=C12/n1;I2/c=I12/c1;Pm3=Pm-3;Pn3=Pn-3;Fm3=Fm-3;Fd3=Fd-3;Im3=Im-3;Pa3=Pa-3;Ia3=Ia-3;Pm3m=Pm-3m;Pn3n=Pn-3n;Pm3n=Pm-3n;Pn3m=Pn-3m;Fm3m=Fm-3m;Fm3c=Fm-3c;Fd3m=Fd-3m;Fd3c=Fd-3c;Im3m=Im-3m;Ia3d=Ia-3d;".substring(";P2=P121;P21=P1211;C2=C121;A2=A121;I2=I121;Pm=P1m1;Pc=P1c1;Pn=P1n1;Pa=P1a1;Cm=C1m1;Am=A1m1;Im=I1m1;Cc=C1c1;An=A1n1;Ia=I1a1;Aa=A1a1;Cn=C1n1;Ic=I1c1;P2/m=P12/m1;P21/m=P121/m1;C2/m=C12/m1;A2/m=A12/m1;I2/m=I12/m1;P2/c=P12/c1;P2/n=P12/n1;P2/a=P12/a1;P21/c=P121/c1;P21/n=P121/n1;P21/a=P121/a1;C2/c=C12/c1;A2/n=A12/n1;I2/a=I12/a1;A2/a=A12/a1;C2/n=C12/n1;I2/c=I12/c1;Pm3=Pm-3;Pn3=Pn-3;Fm3=Fm-3;Fd3=Fd-3;Im3=Im-3;Pa3=Pa-3;Ia3=Ia-3;Pm3m=Pm-3m;Pn3n=Pn-3n;Pm3n=Pm-3n;Pn3m=Pn-3m;Fm3m=Fm-3m;Fm3c=Fm-3c;Fd3m=Fd-3m;Fd3c=Fd-3c;Im3m=Im-3m;Ia3d=Ia-3d;".indexOf("=", pt) + 1, ";P2=P121;P21=P1211;C2=C121;A2=A121;I2=I121;Pm=P1m1;Pc=P1c1;Pn=P1n1;Pa=P1a1;Cm=C1m1;Am=A1m1;Im=I1m1;Cc=C1c1;An=A1n1;Ia=I1a1;Aa=A1a1;Cn=C1n1;Ic=I1c1;P2/m=P12/m1;P21/m=P121/m1;C2/m=C12/m1;A2/m=A12/m1;I2/m=I12/m1;P2/c=P12/c1;P2/n=P12/n1;P2/a=P12/a1;P21/c=P121/c1;P21/n=P121/n1;P21/a=P121/a1;C2/c=C12/c1;A2/n=A12/n1;I2/a=I12/a1;A2/a=A12/a1;C2/n=C12/n1;I2/c=I12/c1;Pm3=Pm-3;Pn3=Pn-3;Fm3=Fm-3;Fd3=Fd-3;Im3=Im-3;Pa3=Pa-3;Ia3=Ia-3;Pm3m=Pm-3m;Pn3n=Pn-3n;Pm3n=Pm-3n;Pn3m=Pn-3m;Fm3m=Fm-3m;Fm3c=Fm-3c;Fd3m=Fd-3m;Fd3c=Fd-3c;Im3m=Im-3m;Ia3d=Ia-3d;".indexOf(";", pt + 1)); +}JU.Logger.info("CgdReader using GROUP " + name + (name0 == null ? "" : " alias of " + name0)); +return name; +}, "~S"); +Clazz.defineMethod(c$, "atom", +function(){ +var name = this.getName(this.tokens[1]); +var edgeCount = this.parseIntStr(this.tokens[2]); +for (var i = 3; i < 6; i++) if (this.tokens[i].indexOf("/") >= 0) this.tokens[i] = "" + JU.PT.parseFloatFraction(this.tokens[i]); + +var a = this.addAtomXYZSymName(this.tokens, 3, null, name); +if (!this.doApplySymmetry) return; +this.asc.atomSymbolicMap.put(name, a); +this.asc.addVibrationVector(a.index, 1, 3, 7); +if (this.htEdges == null) this.htEdges = new java.util.Hashtable(); +this.htEdges.put(a, new Array(edgeCount)); +}); +Clazz.defineMethod(c$, "getName", +function(name){ +return (name.charAt(0) == '"' ? name.substring(1, name.length - 1) : Character.isDigit(name.charAt(0)) ? "C" + name : name); +}, "~S"); +Clazz.overrideMethod(c$, "finalizeSubclassReader", +function(){ +this.finalizeReaderASCR(); +if (this.doApplySymmetry) this.finalizeNet(); +}); +Clazz.defineMethod(c$, "finalizeEdges", +function(){ +var p; +var name; +var a; +var atomEdges; +for (var j = 0; j < this.edgeData.size(); j++) { +this.tokens = JU.PT.getTokens(this.line = this.edgeData.get(j)); +switch (this.tokens.length) { +case 3: +name = this.getName(this.tokens[1]); +a = this.asc.getAtomFromName(name); +atomEdges = this.htEdges.get(a); +p = this.asc.getAtomFromName(this.getName(this.tokens[2])); +break; +case 5: +name = this.getName(this.tokens[1]); +a = this.asc.getAtomFromName(name); +atomEdges = this.htEdges.get(a); +p = this.getCoord(2); +break; +case 7: +atomEdges = this.htEdges.get(this.findAtom(this.getCoord(1))); +p = this.getCoord(4); +break; +default: +JU.Logger.error("EDGE record skipped: " + this.line); +continue; +} +for (var i = 0, n = atomEdges.length; i < n; i++) if (atomEdges[i] == null) { +atomEdges[i] = JU.V3.newV(p); +break; +} +} +}); +Clazz.defineMethod(c$, "getCoord", +function(i){ +return JU.P3.new3(JU.PT.parseFloatFraction(this.tokens[i++]), JU.PT.parseFloatFraction(this.tokens[i++]), JU.PT.parseFloatFraction(this.tokens[i++])); +}, "~N"); +Clazz.defineMethod(c$, "finalizeNet", +function(){ +this.finalizeEdges(); +var m = new JU.M3(); +var pt = new JU.P3(); +for (var i = 0, n = this.asc.ac; i < n; i++) { +var a = this.asc.atoms[i]; +var a0 = this.asc.atoms[a.atomSite]; +if (this.noBondSym && a !== a0) continue; +var edges = this.htEdges.get(a0); +if (edges == null) continue; +var ix = Clazz.floatToInt(a.vib.x) + 7; +var iy = Clazz.floatToInt(a.vib.y) + 7; +var iz = Clazz.floatToInt(a.vib.z) + 7; +m.setRowV(0, J.adapter.readers.xtal.CgdReader.vecs[ix]); +m.setRowV(1, J.adapter.readers.xtal.CgdReader.vecs[iy]); +m.setRowV(2, J.adapter.readers.xtal.CgdReader.vecs[iz]); +for (var j = 0, n1 = edges.length; j < n1; j++) { +pt.sub2(edges[j], a0); +m.rotate(pt); +pt.add(a); +var b = this.findAtom(pt); +if (b != null) this.asc.addBond( new J.adapter.smarter.Bond(a.index, b.index, 1)); + else if (pt.x >= 0 && pt.x <= 1 && pt.y >= 0 && pt.y <= 1 && pt.z >= 0 && pt.z <= 1) JU.Logger.error(" not found: i=" + i + " pt=" + pt + " for a=" + a + "\n a0=" + a0 + " edge[" + j + "]=" + edges[j] + "\n a.vib=" + a.vib + "\n m=" + m); +} +a.vib = null; +} +}); +Clazz.defineMethod(c$, "findAtom", +function(pt){ +for (var i = this.asc.ac; --i >= 0; ) if (this.asc.atoms[i].distanceSquared(pt) < 0.00001) return this.asc.atoms[i]; + +return null; +}, "JU.P3"); +c$.vecs = Clazz.newArray(-1, [JU.V3.new3(0, 0, -1), JU.V3.new3(1, 0, -1), null, JU.V3.new3(0, 1, -1), JU.V3.new3(0, -1, 0), JU.V3.new3(1, -1, 0), JU.V3.new3(-1, 0, 0), null, JU.V3.new3(1, 0, 0), JU.V3.new3(-1, 1, 0), JU.V3.new3(0, 1, 0), JU.V3.new3(0, -1, 1), null, JU.V3.new3(-1, 0, 1), JU.V3.new3(0, 0, 1)]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/CmdfReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/CmdfReader.js new file mode 100755 index 000000000000..6ec8510a6392 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/CmdfReader.js @@ -0,0 +1,121 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.xtal.CmdfReader", ["J.adapter.smarter.Atom", "J.api.JmolAdapter"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.buf = null; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "CmdfReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.prepareFields (c$, function(){ +this.buf = Clazz.newByteArray (100, 0); +}); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.setFractionalCoordinates(true); +}); +Clazz.overrideMethod(c$, "processBinaryDocument", +function(){ +this.binaryDoc.setStream(null, false); +this.binaryDoc.seek(28); +var len = this.binaryDoc.readInt(); +System.out.println("file length: " + len + " " + Integer.toHexString(len)); +this.seek("CELL", 32); +var uc = Clazz.newFloatArray (6, 0); +for (var i = 0; i < 6; i++) { +uc[i] = this.binaryDoc.readFloat(); +} +this.setUnitCell(uc[0], uc[1], uc[2], uc[3], uc[4], uc[5]); +this.seek("SYMM", -1); +var sg = J.adapter.readers.xtal.CmdfReader.fixSpaceGroup(this.binaryDoc.readString(20)); +this.setSpaceGroupName(sg); +System.out.println("Space group is " + sg); +this.readAtoms(); +System.out.println("done"); +}); +c$.fixSpaceGroup = Clazz.defineMethod(c$, "fixSpaceGroup", +function(sg){ +var pt = sg.indexOf('\0'); +if (pt == 0) System.out.println("SYMM: empty;NO space group??"); +return (pt < 0 ? sg : sg.substring(0, pt)).trim(); +}, "~S"); +Clazz.defineMethod(c$, "readAtoms", +function(){ +this.seek("AUN7", 32); +var nSites = this.binaryDoc.readInt(); +System.out.println(nSites + " sites"); +for (var i = 0; i < nSites; i++) this.readSite(); + +}); +Clazz.defineMethod(c$, "readSite", +function(){ +var nOccupants = this.binaryDoc.readByte(); +var atoms = new Array(nOccupants); +for (var i = 0; i < nOccupants; i++) { +var a = atoms[i] = new J.adapter.smarter.Atom(); +var ch2 = String.fromCharCode(this.binaryDoc.readByte()); +var ch1 = String.fromCharCode(this.binaryDoc.readByte()); +a.elementSymbol = J.adapter.readers.xtal.CmdfReader.getSymbol("" + ch1 + ch2); +if (J.api.JmolAdapter.getElementNumber(a.elementSymbol) == 0) { +System.out.println("ELEMENT error " + a.elementSymbol + " " + this.fileName); +}a.foccupancy = this.binaryDoc.readFloat(); +this.asc.addAtom(a); +} +this.binaryDoc.readInt(); +var sym0 = atoms[0].elementSymbol; +var name = this.readString(); +var valence = this.binaryDoc.readInt(); +for (var i = 0; i < nOccupants; i++) { +atoms[i].atomName = (i == 0 || sym0.length > name.length ? name : atoms[i].elementSymbol + name.substring(sym0.length)); +} +var unk3s = this.binaryDoc.readShort() & 0xFFFF; +var x = this.binaryDoc.readFloat(); +var y = this.binaryDoc.readFloat(); +var z = this.binaryDoc.readFloat(); +for (var i = 0; i < nOccupants; i++) { +this.setAtomCoordXYZ(atoms[i], x, y, z); +} +var index2 = this.binaryDoc.readInt() / 32; +var unk4b = this.binaryDoc.readByte() & 0xFF; +var siteNumber = this.binaryDoc.readShort(); +var unk5b = this.binaryDoc.readByte() & 0xFF; +var wyn = this.binaryDoc.readInt(); +var wyabc = this.binaryDoc.readByte(); +var wyckoff = "" + wyn + String.fromCharCode(0x60 + wyabc); +System.out.println("SITE " + siteNumber + " occ=" + nOccupants + " " + atoms[0].elementSymbol + " " + atoms[0].atomName + " " + wyckoff + " " + atoms[0] + (nOccupants > 1 ? atoms[1].atomName : "") + " valence=" + valence + " " + index2 + " " + Integer.toHexString(unk3s) + " " + Integer.toHexString(unk4b) + " " + Integer.toHexString(unk5b)); +return; +}); +Clazz.defineMethod(c$, "readString", +function(){ +var n = this.binaryDoc.readByte(); +this.binaryDoc.readByteArray(this.buf, 0, n); +return String.instantialize(this.buf, 0, n); +}); +Clazz.defineMethod(c$, "seek", +function(label, where){ +var bytes = label.getBytes(); +if (where > 0) this.binaryDoc.seek(where); +var p = (where >= 0 ? where : this.binaryDoc.getPosition()); +System.out.println("looking for " + label + " @" + p); +var off = 0; +var n = bytes.length; +var p0 = p; +while (off < n) { +var b = this.binaryDoc.readByte(); +p++; +if (b == bytes[off]) { +off++; +} else if (off > 0) { +this.binaryDoc.seek(p = p0 = p0 + 1); +off = 0; +}} +System.out.println(label + " found at " + (p - n)); +return p; +}, "~S,~N"); +c$.getSymbol = Clazz.defineMethod(c$, "getSymbol", +function(sym){ +if (sym == null) return "Xx"; +var len = sym.length; +if (len < 2) return sym; +var ch1 = sym.charAt(1); +if (ch1 >= 'a' && ch1 <= 'z') return sym.substring(0, 2); +return "" + sym.charAt(0); +}, "~S"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/CrystalReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/CrystalReader.js new file mode 100755 index 000000000000..deb01b20b2d5 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/CrystalReader.js @@ -0,0 +1,812 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader", "JU.Lst", "$.P3"], "J.adapter.readers.xtal.CrystalReader", ["java.util.Arrays", "$.Hashtable", "JU.DF", "$.M3", "$.M4", "$.PT", "$.Quat", "$.SB", "$.V3", "JS.SymmetryOperation", "JU.Logger", "$.Tensor"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.isVersion3 = false; +this.isPolymer = false; +this.isSlab = false; +this.haveCharges = false; +this.inputOnly = false; +this.isLongMode = false; +this.getLastConventional = false; +this.havePrimitiveMapping = false; +this.isProperties = false; +this.state = 0; +this.ac = 0; +this.atomIndexLast = 0; +this.atomFrag = null; +this.primitiveToIndex = null; +this.nuclearCharges = null; +this.lstCoords = null; +this.energy = null; +this.ptOriginShift = null; +this.directLatticeVectors = null; +this.spaceGroupName = null; +this.checkModelTrigger = false; +this.fullSymmetry = false; +this.htCriticalPoints = null; +this.directLatticeVectorsFirst = false; +this.cpno = -1; +this.symops = null; +this.f14 = null; +this.f16 = null; +this.primitiveVolume = 0; +this.primitiveDensity = 0; +this.firstLine = null; +this.type = null; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "CrystalReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.prepareFields (c$, function(){ +this.ptOriginShift = new JU.P3(); +this.symops = new JU.Lst(); +this.f14 = Clazz.newFloatArray (14, 0); +this.f16 = Clazz.newFloatArray (16, 0); +}); +Clazz.defineMethod(c$, "rd", +function(){ +while (Clazz.superCall(this, J.adapter.readers.xtal.CrystalReader, "rd", []) != null && (this.line.startsWith(" PROCESS") || this.line.startsWith(" INFORMATION") || this.line.startsWith(" WARNING"))) { +} +return this.line; +}); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.doProcessLines = false; +this.inputOnly = this.checkFilterKey("INPUT"); +this.isPrimitive = !this.inputOnly && !this.checkFilterKey("CONV"); +this.addVibrations = new Boolean (this.addVibrations & (!this.inputOnly && this.desiredModelNumber < 0)).valueOf(); +this.getLastConventional = (!this.isPrimitive && this.desiredModelNumber == 0); +this.fullSymmetry = this.checkFilterKey("FULLSYM"); +this.setFractionalCoordinates(this.readHeader()); +this.asc.crystalReaderLatticeOpsOnly = !this.inputOnly; +}); +Clazz.overrideMethod(c$, "checkLine", +function(){ +if (this.firstLine != null) { +this.line = this.firstLine; +this.firstLine = null; +}if (this.line.startsWith(" TYPE OF CALCULATION")) { +this.calculationType = this.line.substring(this.line.indexOf(":") + 1).trim(); +return true; +}if (this.line.indexOf("DIMENSIONALITY OF THE SYSTEM") >= 0) { +this.isMolecular = this.isSlab = this.isPolymer = false; +if (this.line.indexOf("2") >= 0) this.isSlab = true; + else if (this.line.indexOf("1") >= 0) this.isPolymer = true; + else if (this.line.indexOf("0") >= 0) this.isMolecular = true; +return true; +}if (!this.isPolymer && this.line.indexOf("CONSTRUCTION OF A NANOTUBE FROM A SLAB") >= 0) { +this.isPolymer = true; +this.isSlab = false; +return true; +}if (!this.isMolecular && this.line.indexOf("* CLUSTER CALCULATION") >= 0) { +this.isMolecular = true; +this.isSlab = false; +this.isPolymer = false; +return true; +}if (this.line.startsWith(" INPUT COORDINATES")) { +this.state = 1; +if (this.inputOnly) { +this.newAtomSet(); +this.readCoordLines(); +this.continuing = false; +}return true; +}if (this.line.startsWith(" GEOMETRY INPUT FROM EXTERNAL")) { +this.state = 2; +if (this.inputOnly) this.continuing = false; +return true; +}if (this.line.startsWith(" GEOMETRY FOR WAVE FUNCTION")) { +this.state = 3; +return true; +}if (this.line.startsWith(" COORDINATE OPTIMIZATION - POINT")) { +this.state = 4; +return true; +}if (this.line.startsWith(" FINAL OPTIMIZED GEOMETRY")) { +this.getLastConventional = false; +this.state = 5; +return true; +}if (this.addVibrations && this.line.contains(this.isVersion3 ? "EIGENVALUES (EV) OF THE MASS" : "EIGENVALUES (EIGV) OF THE MASS") || this.line.indexOf("LONGITUDINAL OPTICAL (LO)") >= 0) { +this.state = 6; +this.isLongMode = (this.line.indexOf("LONGITUDINAL OPTICAL (LO)") >= 0); +this.readFrequencies(); +return true; +}if (this.line.startsWith(" TRANSFORMATION MATRIX")) { +this.readPrimitiveLatticeVectors(); +return true; +}if (this.line.startsWith(" COORDINATES OF THE EQUIVALENT ATOMS") || this.line.startsWith(" INPUT LIST - ATOM N.")) { +return true; +}if (this.line.indexOf("SYMMOPS - ") >= 0) { +this.readSymmetryOperators(); +return true; +}if (this.line.startsWith(" LATTICE PARAMETER")) { +this.newLattice(this.line.indexOf("- CONVENTIONAL") >= 0); +return true; +}if (this.line.startsWith(" CRYSTALLOGRAPHIC CELL")) { +if (!this.isPrimitive) { +this.newLattice(true); +}return true; +}if (this.line.startsWith(" DIRECT LATTICE VECTOR")) { +this.getDirect(); +return true; +}if (this.line.startsWith(" COORDINATES IN THE CRYSTALLOGRAPHIC CELL")) { +this.checkModelTrigger = !this.isPrimitive; +if (this.checkModelTrigger) { +this.readCoordLines(); +}return true; +}if (this.addVibrations && this.line.startsWith(" FREQUENCIES COMPUTED ON A FRAGMENT")) { +this.readFreqFragments(); +return true; +}if (this.checkModelTrigger) { +if (this.line.indexOf("CARTESIAN COORDINATES") >= 0 || this.line.indexOf("TOTAL ENERGY") >= 0 || this.line.indexOf("REFERENCE GEOMETRY DEFINED") >= 0 || this.line.indexOf("FUNCTIONS") >= 0) { +this.checkModelTrigger = false; +if (!this.addModel()) return true; +}}if (this.line.startsWith(" ATOMS IN THE ASYMMETRIC UNIT")) { +if (this.isMolecular) return (this.doGetModel(++this.modelNumber, null) ? this.readAtoms() : this.checkLastModel()); +this.readCoordLines(); +this.checkModelTrigger = true; +}if (this.isProperties && this.line.startsWith(" ATOM N.AT.")) { +if (this.doGetModel(++this.modelNumber, null)) this.readAtoms(); + else this.checkLastModel(); +}if (!this.doProcessLines) return true; +if (this.line.startsWith(" TOTAL ENERGY(")) { +this.line = JU.PT.rep(this.line, "( ", "("); +var tokens = this.getTokens(); +this.energy = Double.$valueOf(Double.parseDouble(tokens[2])); +this.setEnergy(); +this.rd(); +if (this.line.startsWith(" ********")) this.discardLinesUntilContains("SYMMETRY ALLOWED"); + else if (this.line.startsWith(" TTTTTTTT")) this.discardLinesUntilContains(" *******"); +return true; +}if (this.line.startsWith(" MULLIKEN POPULATION ANALYSIS")) return this.readPartialCharges(); +if (this.line.startsWith(" TOTAL ATOMIC CHARGES")) return this.readTotalAtomicCharges(); +if (this.line.startsWith(" MAX GRADIENT")) return this.readGradient(); +if (this.line.startsWith(" ATOMIC SPINS SET")) return this.readData("spin", 3); +if (this.line.startsWith(" TOTAL ATOMIC SPINS :")) return this.readData("magneticMoment", 1); +if (this.line.startsWith(" BORN CHARGE TENSOR.")) return this.readBornChargeTensors(); +if (!this.isProperties) return true; +if (this.line.startsWith(" DEFINITION OF TRACELESS")) return this.getQuadrupoleTensors(); +if (this.line.startsWith(" MULTIPOLE ANALYSIS BY ATOMS")) { +this.appendLoadNote("Multipole Analysis"); +return true; +}if (this.line.startsWith(" CP N. ")) { +this.cpno = this.parseIntAt(this.line, 6); +return true; +}if (this.line.startsWith(" CP TYPE ")) { +this.processNextCriticalPoint(); +return true; +}return true; +}); +Clazz.defineMethod(c$, "processNextCriticalPoint", +function(){ +if (this.htCriticalPoints == null) { +this.htCriticalPoints = new java.util.Hashtable(); +this.asc.setModelInfoForSet("criticalPoints", this.htCriticalPoints, 0); +}var nblank = 0; +var id = null; +var entry = null; +var f = 0.5291772; +var m = null; +var v = NaN; +var g = NaN; +var rho = NaN; +var evalues = null; +var type = null; +while (this.line != null || this.rd().length > 0 || ++nblank < 2) { +if (this.line.indexOf("CLUSTER") >= 0) { +break; +}if (this.line.length > 0) nblank = 0; +var pt = this.line.indexOf(":"); +if (pt > 0) { +var key = this.line.substring(0, pt).trim(); +var value = this.line.substring(pt + 1); +if (key.equals("CP TYPE")) { +type = J.adapter.readers.xtal.CrystalReader.crtypes[Clazz.doubleToInt("??,-3,-1,+1,+3".indexOf(value.substring(5, 7)) / 3)]; +entry = this.htCriticalPoints.get(type); +if (entry == null) { +this.htCriticalPoints.put(type, entry = new JU.Lst()); +}m = new java.util.Hashtable(); +entry.addLast(m); +var i = entry.size(); +id = "cp_" + i; +m.put("cpno", Integer.$valueOf(this.cpno)); +m.put("id", id); +m.put("type", type); +m.put("index", Integer.$valueOf(i)); +} else if (key.equals("COORD(AU) (X Y Z)")) { +var xyz = JU.P3.new3(f * this.parseFloatStr(value.substring(0, 12)), f * this.parseFloatStr(value.substring(12, 24)), f * this.parseFloatStr(value.substring(24, 36))); +m.put("point", xyz); +JU.Logger.info("CRYSTAL TOPOND critical point " + type + " " + xyz); +} else if (key.equals("PROPERTIES (RHO,GRHO,LAP)")) { +rho = this.parseFloatStr(value.substring(0, 12)); +m.put("rho", Float.$valueOf(rho)); +m.put("lap", Float.$valueOf(this.parseFloatStr(value.substring(24, 36)))); +} else if (key.equals("PROPERTIES (-LAP,GLAP,RHO)")) { +m.put("lap", Float.$valueOf(-this.parseFloatStr(value.substring(0, 12)))); +rho = this.parseFloatStr(value.substring(24, 36)); +m.put("rho", Float.$valueOf(rho)); +} else if (key.equals("KINETIC ENERGY DENSITIES (G,K)")) { +g = this.parseFloatStr(value.substring(0, 12)); +m.put("kineticEnergyG", Float.$valueOf(g)); +} else if (key.equals("VIRIAL DENSITY")) { +v = this.parseFloatStr(value.substring(0, 12)); +m.put("virialDensityV", Float.$valueOf(v)); +m.put("ratioVG", Float.$valueOf(Math.abs(v) / g)); +m.put("energyDensityH", Float.$valueOf(g + v)); +m.put("ratioHRho", Float.$valueOf((g + v) / rho)); +} else if (key.equals("EIGENVALUES (L1 L2 L3)")) { +var e1 = this.parseFloatStr(value.substring(0, 12)); +var e2 = this.parseFloatStr(value.substring(12, 24)); +var e3 = this.parseFloatStr(value.substring(24, 36)); +evalues = Clazz.newFloatArray(-1, [e1, e2, e3]); +m.put("eigenvalues", evalues); +m.put("ellipticity", Float.$valueOf(e1 / e2 - 1)); +m.put("anisotropy", Float.$valueOf(e3 - Math.abs(e1 + e2) / 2)); +} else if (key.equals("EIGENVECTORS")) { +value = value + this.rd().substring(33) + this.rd().substring(33); +var ev = Clazz.newDoubleArray (3, 3, 0); +for (var ei = 0, p = 0; ei < 3; ei++) { +for (var ej = 0; ej < 3; ej++, p += 12) { +ev[ej][ei] = this.parseFloatStr(value.substring(p, p + 12)); +} +} +var evectors = new Array(3); +evectors[0] = JU.P3.new3(ev[0][0], ev[0][1], ev[0][2]); +evectors[1] = JU.P3.new3(ev[1][0], ev[1][1], ev[1][2]); +evectors[2] = JU.P3.new3(ev[2][0], ev[2][1], ev[2][2]); +System.out.println("evpts " + evectors[0] + " " + evectors[1] + " " + evectors[2]); +m.put("eigenvectors", evectors); +var t = new JU.Tensor().setFromEigenVectors(evectors, evalues, "cp", id, null); +m.put("tensor", t); +}}this.line = null; +} +}); +Clazz.defineMethod(c$, "newLattice", +function(isConv){ +this.lstCoords = null; +this.readLatticeParams(!isConv); +this.symops.clear(); +if (!isConv) this.primitiveToCrystal = null; +if (!this.directLatticeVectorsFirst) this.directLatticeVectors = null; +}, "~B"); +Clazz.defineMethod(c$, "addModel", +function(){ +if (this.getLastConventional) { +return true; +}if (!this.doGetModel(++this.modelNumber, null)) { +this.lstCoords = null; +this.checkLastModel(); +if (this.asc.iSet >= 0) this.asc.removeAtomSet(this.asc.iSet); +return false; +}this.processCoordLines(); +return true; +}); +Clazz.defineMethod(c$, "readSymmetryOperators", +function(){ +this.symops.clear(); +this.rd(); +this.f16[15] = 1; +while (this.rd() != null && this.line.length > 0 && this.line.indexOf("END") < 0) { +if (this.line.indexOf("V INV") >= 0) continue; +this.fillFloatArray(this.line, 0, this.f14); +if (Float.isNaN(this.f14[0])) break; +for (var i = 0; i < 12; i++) this.f16[i] = this.f14[J.adapter.readers.xtal.CrystalReader.smap[i]]; + +JU.Logger.info("CrystalReader: " + this.line); +if (this.isSlab || this.isPolymer) continue; +var m4 = JU.M4.newA16(this.f16); +var xyz = JS.SymmetryOperation.getXYZFromMatrix(m4, false, false, false); +if (xyz.indexOf("0y") >= 0 || xyz.indexOf("0z") >= 0) { +JU.Logger.error("CrystalReader: Symmetry operator could not be created for " + xyz); +} else { +this.symops.addLast(xyz); +JU.Logger.info("CrystalReader: state=" + this.state + " Symmop " + this.symops.size() + ": " + xyz); +}} +}); +Clazz.overrideMethod(c$, "finalizeSubclassReader", +function(){ +this.asc.setInfo("symmetryType", (this.isSlab ? "2D - SLAB" : this.isPolymer ? "1D - POLYMER" : this.type)); +this.processCoordLines(); +if (this.energy != null) this.setEnergy(); +this.finalizeReaderASCR(); +this.asc.checkNoEmptyModel(); +if (this.htCriticalPoints != null) { +var note = ""; +var list; +list = this.htCriticalPoints.get("nuclei"); +if (list != null) note += "\n _M.criticalPoints.nuclei.length = " + list.size(); +list = this.htCriticalPoints.get("bonds"); +if (list != null) note += "\n _M.criticalPoints.bonds.length = " + list.size(); +list = this.htCriticalPoints.get("rings"); +if (list != null) note += "\n _M.criticalPoints.rings.length = " + list.size(); +list = this.htCriticalPoints.get("cages"); +if (list != null) note += "\n _M.criticalPoints.cages.length = " + list.size(); +note += "\n Use MACRO TOPOND for TOPOND functions."; +this.addJmolScript("set drawHover"); +this.appendLoadNote(note); +this.setLoadNote(); +}}); +Clazz.defineMethod(c$, "getDirect", +function(){ +this.directLatticeVectors = this.read3Vectors(this.line.indexOf("(BOHR") >= 0); +if (!this.iHaveUnitCell) this.directLatticeVectorsFirst = true; +}); +Clazz.defineMethod(c$, "setUnitCellOrientation", +function(){ +if (this.directLatticeVectors == null) return; +var a = new JU.V3(); +var b = new JU.V3(); +if (this.isPrimitive) { +a = this.directLatticeVectors[0]; +b = this.directLatticeVectors[1]; +} else { +if (this.primitiveToCrystal == null) return; +var mp = new JU.M3(); +mp.setColumnV(0, this.directLatticeVectors[0]); +mp.setColumnV(1, this.directLatticeVectors[1]); +mp.setColumnV(2, this.directLatticeVectors[2]); +mp.mul(this.primitiveToCrystal); +a = new JU.V3(); +b = new JU.V3(); +mp.getColumnV(0, a); +mp.getColumnV(1, b); +}this.matUnitCellOrientation = JU.Quat.getQuaternionFrame( new JU.P3(), a, b).getMatrix(); +JU.Logger.info("oriented unit cell is in model " + this.asc.atomSetCount); +}); +Clazz.defineMethod(c$, "readPrimitiveLatticeVectors", +function(){ +this.primitiveToCrystal = JU.M3.newA9(this.fillFloatArray(null, 0, Clazz.newFloatArray (9, 0))); +}); +Clazz.defineMethod(c$, "readHeader", +function(){ +this.havePrimitiveMapping = true; +this.discardLinesUntilContains("*******************************************************************************"); +this.readLines(2); +this.isVersion3 = (this.line.indexOf("CRYSTAL03") >= 0); +this.discardLinesUntilContains("EEEEEEEEEE"); +this.rd(); +var name; +if (this.line.length == 0) { +this.discardLinesUntilContains("*********"); +name = this.rd().trim(); +} else { +name = this.line.trim(); +this.rd(); +}this.type = this.rd().trim(); +var pt = this.type.indexOf("- PROPERTIES"); +if (pt >= 0) { +this.isProperties = true; +this.type = this.type.substring(0, pt).trim(); +}this.asc.setCollectionName(name + (!this.isProperties && this.desiredModelNumber == 0 ? " (optimized)" : "")); +if (this.type.indexOf("GEOMETRY INPUT FROM EXTERNAL FILE") >= 0) { +this.firstLine = this.line; +this.type = this.rd().trim(); +}this.isPolymer = (this.type.equals("1D - POLYMER") || this.type.equals("POLYMER CALCULATION")); +this.isSlab = (this.type.equals("2D - SLAB") || this.type.equals("SLAB CALCULATION")); +if ((this.isPolymer || this.isSlab) && !this.isPrimitive) { +JU.Logger.error("Cannot use FILTER \"conventional\" with POLYMER or SLAB"); +this.isPrimitive = true; +}this.asc.setInfo("unitCellType", (this.isPrimitive ? "primitive" : "conventional")); +if (this.type.indexOf("MOLECULAR") >= 0) { +this.isMolecular = this.doProcessLines = true; +this.rd(); +this.asc.setInfo("molecularCalculationPointGroup", this.line.substring(this.line.indexOf(" OR ") + 4).trim()); +return false; +}this.discardLinesUntilContains2("SPACE GROUP", "****"); +pt = this.line.indexOf(":"); +if (pt >= 0 && !this.isPrimitive) this.spaceGroupName = this.line.substring(pt + 1).trim(); +this.doApplySymmetry = this.isProperties; +return !this.isProperties; +}); +Clazz.defineMethod(c$, "readLatticeParams", +function(isPrimitive){ +var f = (this.line.indexOf("(BOHR") >= 0 ? 0.5291772 : 1); +if (isPrimitive) this.newAtomSet(); +this.primitiveVolume = 0; +this.primitiveDensity = 0; +if (this.isPolymer && !isPrimitive && this.line.indexOf("BOHR =") < 0) { +this.setUnitCell(this.parseFloatStr(this.line.substring(this.line.indexOf("CELL") + 4)) * f, -1, -1, 90, 90, 90); +} else { +while (this.rd().indexOf("GAMMA") < 0) if (this.line.indexOf("VOLUME=") >= 0) { +this.primitiveVolume = this.parseFloatStr(this.line.substring(43)); +this.primitiveDensity = this.parseFloatStr(this.line.substring(66)); +} +var tokens = JU.PT.getTokens(this.rd()); +var a = this.parseFloatStr(tokens[0]); +var b = this.parseFloatStr(tokens[1]); +if (!this.isSlab && !this.isPolymer && tokens.length == 7) { +this.primitiveVolume = this.parseFloatStr(tokens[6]); +if (Math.abs(this.primitiveVolume - a * b) < 0.1) { +this.isSlab = true; +}}if (this.isSlab) { +if (isPrimitive) this.setUnitCell(a * f, b * f, -1, this.parseFloatStr(tokens[3]), this.parseFloatStr(tokens[4]), this.parseFloatStr(tokens[5])); + else this.setUnitCell(a * f, b * f, -1, 90, 90, this.parseFloatStr(tokens[2])); +} else if (this.isPolymer) { +this.setUnitCell(a, -1, -1, this.parseFloatStr(tokens[3]), this.parseFloatStr(tokens[4]), this.parseFloatStr(tokens[5])); +} else { +this.setUnitCell(a * f, b * f, this.parseFloatStr(tokens[2]) * f, this.parseFloatStr(tokens[3]), this.parseFloatStr(tokens[4]), this.parseFloatStr(tokens[5])); +}}}, "~B"); +Clazz.defineMethod(c$, "getAtomIndexFromPrimitiveIndex", +function(iPrim){ +return (this.primitiveToIndex == null ? iPrim : this.primitiveToIndex[iPrim]); +}, "~N"); +Clazz.defineMethod(c$, "readAtoms", +function(){ +if (this.isMolecular) this.newAtomSet(); +this.lstCoords = null; +while (this.rd() != null && this.line.indexOf("*") < 0) { +if (this.line.indexOf("X(ANGSTROM") >= 0) { +this.setFractionalCoordinates(false); +this.isMolecular = true; +}} +var i = this.atomIndexLast; +var doNormalizePrimitive = false; +this.atomIndexLast = this.asc.ac; +var isFractional = this.iHaveFractionalCoordinates; +if (!isFractional) { +this.setUnitCellOrientation(); +if (this.matUnitCellOrientation != null) this.getSymmetry().initializeOrientation(this.matUnitCellOrientation); +}while (this.rd() != null && this.line.length > 0 && this.line.indexOf(this.isPrimitive ? "*" : "=") < 0) { +var atom = this.asc.addNewAtom(); +var tokens = this.getTokens(); +var pt = (this.isProperties ? 1 : 2); +atom.elementSymbol = J.adapter.smarter.AtomSetCollectionReader.getElementSymbol(this.getAtomicNumber(tokens[pt++])); +atom.atomName = J.adapter.readers.xtal.CrystalReader.fixAtomName(tokens[pt++]); +if (this.isProperties) pt++; +var x = this.parseFloatStr(tokens[pt++]); +var y = this.parseFloatStr(tokens[pt++]); +var z = this.parseFloatStr(tokens[pt]); +if (this.haveCharges) atom.partialCharge = this.asc.atoms[i++].partialCharge; +if (isFractional && !this.isProperties) { +if (x < 0 && (this.isPolymer || this.isSlab || doNormalizePrimitive)) x += 1; +if (y < 0 && (this.isSlab || doNormalizePrimitive)) y += 1; +if (z < 0 && doNormalizePrimitive) z += 1; +}this.setAtomCoordXYZ(atom, x, y, z); +} +this.ac = this.asc.ac - this.atomIndexLast; +return true; +}); +c$.fixAtomName = Clazz.defineMethod(c$, "fixAtomName", +function(s){ +return (s.length > 1 && JU.PT.isLetter(s.charAt(1)) ? s.substring(0, 1) + Character.toLowerCase(s.charAt(1)) + s.substring(2) : s); +}, "~S"); +Clazz.defineMethod(c$, "getAtomicNumber", +function(token){ +return this.parseIntStr(token) % 100; +}, "~S"); +Clazz.defineMethod(c$, "readCoordLines", +function(){ +var atom = (this.inputOnly ? " ATOM" : " ATOM"); +if (this.line.indexOf(atom) < 0) this.discardLinesUntilContains(atom); +this.lstCoords = new JU.Lst(); +while (this.rd() != null && this.line.length > 0) if (this.line.indexOf("****") < 0) this.lstCoords.addLast(this.line); + +}); +Clazz.defineMethod(c$, "processCoordLines", +function(){ +if (this.lstCoords == null) return; +this.ac = this.lstCoords.size(); +var irreducible = null; +for (var i = 0; i < this.ac; i++) { +var atom = this.asc.addNewAtom(); +var tokens = JU.PT.getTokens(this.lstCoords.get(i)); +atom.atomSerial = this.parseIntStr(tokens[0]); +var atomicNumber; +var offset; +switch (tokens.length) { +case 8: +case 7: +atomicNumber = this.getAtomicNumber(tokens[2]); +offset = 4; +if (i == 0) irreducible = Clazz.newFloatArray (this.ac, 0); +if (tokens[1].equals("T")) irreducible[i] = 1; +break; +default: +atomicNumber = this.getAtomicNumber(tokens[1]); +offset = 2; +break; +} +var x = this.parseFloatStr(tokens[offset++]) + this.ptOriginShift.x; +var y = this.parseFloatStr(tokens[offset++]) + this.ptOriginShift.y; +var z = this.parseFloatStr(tokens[offset]) + this.ptOriginShift.z; +this.setAtomCoordXYZ(atom, x, y, z); +atom.elementSymbol = J.adapter.smarter.AtomSetCollectionReader.getElementSymbol(atomicNumber); +} +this.lstCoords = null; +if (irreducible != null) { +this.asc.setAtomProperties("irreducible", irreducible, -1, false); +}if (this.primitiveVolume > 0) { +this.asc.setAtomSetModelProperty("volumePrimitive", JU.DF.formatDecimal(this.primitiveVolume, 3)); +this.asc.setModelInfoForSet("primitiveVolume", Float.$valueOf(this.primitiveVolume), this.asc.iSet); +}if (this.primitiveDensity > 0) { +this.asc.setAtomSetModelProperty("densityPrimitive", JU.DF.formatDecimal(this.primitiveDensity, 3)); +this.asc.setModelInfoForSet("primitiveDensity", Float.$valueOf(this.primitiveDensity), this.asc.iSet); +}}); +Clazz.overrideMethod(c$, "applySymmetryAndSetTrajectory", +function(){ +this.setUnitCellOrientation(); +var m4p2c; +var m4c2p; +if (this.primitiveToCrystal != null) { +this.asc.setModelInfoForSet("primitiveToCrystal", this.primitiveToCrystal, this.asc.iSet); +m4p2c = new JU.M4(); +m4p2c.setRotationScale(this.primitiveToCrystal); +m4p2c.m33 = 1; +this.asc.setModelInfoForSet("mat4PrimitiveToCrystal", m4p2c, this.asc.iSet); +m4c2p = JU.M4.newM4(m4p2c); +m4c2p.invert(); +this.asc.setModelInfoForSet("mat4CrystalToPrimitive", m4c2p, this.asc.iSet); +if (this.symops.size() > 0) { +this.asc.setModelInfoForSet("fileSymmetryOperations", this.symops.clone(), this.asc.iSet); +}}this.iHaveSymmetryOperators = false; +this.applySymTrajASCR(); +}); +Clazz.defineMethod(c$, "newAtomSet", +function(){ +if (this.ac > 0 && this.asc.ac > 0) { +this.applySymmetryAndSetTrajectory(); +this.asc.newAtomSet(); +}if (this.spaceGroupName != null) { +this.setSpaceGroupName(this.spaceGroupName); +}this.ac = 0; +}); +Clazz.defineMethod(c$, "setEnergy", +function(){ +this.asc.setAtomSetEnergy("" + this.energy, this.energy.floatValue()); +this.asc.setCurrentModelInfo("Energy", this.energy); +this.asc.setInfo("Energy", this.energy); +this.asc.setAtomSetName("Energy = " + this.energy + " Hartree"); +}); +Clazz.defineMethod(c$, "readPartialCharges", +function(){ +if (this.haveCharges || this.asc.ac == 0) return true; +this.haveCharges = true; +this.readLines(3); +var atoms = this.asc.atoms; +var i0 = this.asc.getLastAtomSetAtomIndex(); +var iPrim = 0; +while (this.rd() != null && this.line.length > 3) if (this.line.charAt(3) != ' ') { +var iConv = this.getAtomIndexFromPrimitiveIndex(iPrim); +if (iConv >= 0) atoms[i0 + iConv].partialCharge = this.parseFloatRange(this.line, 9, 11) - this.parseFloatRange(this.line, 12, 18); +iPrim++; +} +return true; +}); +Clazz.defineMethod(c$, "readTotalAtomicCharges", +function(){ +var data = new JU.SB(); +while (this.rd() != null && this.line.indexOf("T") < 0) data.append(this.line); + +var tokens = JU.PT.getTokens(data.toString()); +var charges = Clazz.newFloatArray (tokens.length, 0); +if (this.nuclearCharges == null || this.nuclearCharges.length != charges.length) this.nuclearCharges = charges; +if (this.asc.ac == 0) return true; +var atoms = this.asc.atoms; +var i0 = this.asc.getLastAtomSetAtomIndex(); +for (var i = 0; i < charges.length; i++) { +var iConv = this.getAtomIndexFromPrimitiveIndex(i); +if (iConv >= 0) { +charges[i] = this.parseFloatStr(tokens[i]); +atoms[i0 + iConv].partialCharge = this.nuclearCharges[i] - charges[i]; +}} +return true; +}); +Clazz.defineMethod(c$, "readFreqFragments", +function(){ +var numAtomsFrag = this.parseIntRange(this.line, 39, 44); +if (numAtomsFrag < 0) return; +this.atomFrag = Clazz.newIntArray (numAtomsFrag, 0); +var Sfrag = ""; +while (this.rd() != null && this.line.indexOf("(") >= 0) Sfrag += this.line; + +Sfrag = JU.PT.rep(Sfrag, "(", " "); +Sfrag = JU.PT.rep(Sfrag, ")", " "); +var tokens = JU.PT.getTokens(Sfrag); +for (var i = 0, pos = 0; i < numAtomsFrag; i++, pos += 3) this.atomFrag[i] = this.getAtomIndexFromPrimitiveIndex(this.parseIntStr(tokens[pos]) - 1); + +java.util.Arrays.sort(this.atomFrag); +}); +Clazz.defineMethod(c$, "readFrequencies", +function(){ +this.getLastConventional = false; +this.addModel(); +this.energy = null; +this.discardLinesUntilContains("MODES"); +var haveIntensities = (this.line.indexOf("INTENS") >= 0); +this.rd(); +var vData = new JU.Lst(); +var freqAtomCount = (this.atomFrag == null ? this.ac : 0); +while (this.rd() != null && this.line.length > 0) { +var i0 = this.parseIntRange(this.line, 1, 5); +var i1 = this.parseIntRange(this.line, 6, 10); +var irrep = (this.isLongMode ? this.line.substring(48, 51) : this.line.substring(49, 52)).trim(); +var intens = (!haveIntensities ? "not available" : (this.isLongMode ? this.line.substring(53, 61) : this.line.substring(59, 69).$replace(')', ' ')).trim()); +var irActivity = (this.isLongMode ? "A" : this.line.substring(55, 58).trim()); +var ramanActivity = (this.isLongMode ? "I" : this.line.substring(71, 73).trim()); +var data = Clazz.newArray(-1, [irrep, intens, irActivity, ramanActivity]); +for (var i = i0; i <= i1; i++) vData.addLast(data); + +} +var test = (this.isLongMode ? "LO MODES FOR IRREP" : this.isVersion3 ? "THE CORRESPONDING MODES" : "NORMAL MODES NORMALIZED TO CLASSICAL AMPLITUDES"); +this.rd(); +var ramanData = null; +if (this.line.indexOf("
") >= 0) ramanData = this.readRaman(null); +if (!this.line.contains(test)) this.discardLinesUntilContains(test); +this.rd(); +var modelAtomCount = -1; +while (this.rd() != null && this.line.startsWith(" FREQ(CM**-1)")) { +var tokens = JU.PT.getTokens(this.line.substring(15)); +var frequencies = Clazz.newFloatArray (tokens.length, 0); +var frequencyCount = frequencies.length; +for (var i = 0; i < frequencyCount; i++) { +frequencies[i] = this.parseFloatStr(tokens[i]); +if (this.debugging) JU.Logger.debug((this.vibrationNumber + i) + " frequency=" + frequencies[i]); +} +var ignore = Clazz.newBooleanArray(frequencyCount, false); +var iAtom0 = 0; +var nData = vData.size(); +var isFirst = true; +for (var i = 0; i < frequencyCount; i++) { +tokens = vData.get(this.vibrationNumber % nData); +ignore[i] = (!this.doGetVibration(++this.vibrationNumber) || tokens == null); +if (ignore[i]) continue; +this.applySymmetryAndSetTrajectory(); +if (isFirst) { +modelAtomCount = this.asc.getLastAtomSetAtomCount(); +}this.cloneLastAtomSet(this.ac, null); +if (isFirst) { +iAtom0 = this.asc.getLastAtomSetAtomIndex(); +isFirst = false; +}this.setFreqValue(frequencies[i], tokens); +} +this.rd(); +this.fillFrequencyData(iAtom0, freqAtomCount, modelAtomCount, ignore, false, 14, 10, this.atomFrag, 0, null); +this.rd(); +} +if (ramanData != null) this.readRaman(ramanData); +}); +Clazz.defineMethod(c$, "setFreqValue", +function(freq, data){ +var activity = "IR: " + data[2] + ", Ram.: " + data[3]; +this.asc.setAtomSetFrequency(this.vibrationNumber, null, activity, "" + freq, null); +this.asc.setAtomSetModelProperty("IRintensity", data[1] + " km/Mole"); +this.asc.setAtomSetModelProperty("vibrationalSymmetry", data[0]); +this.asc.setAtomSetModelProperty("IRactivity", data[2]); +this.asc.setAtomSetModelProperty("Ramanactivity", data[3]); +this.asc.setAtomSetName((this.isLongMode ? "LO " : "") + data[0] + " " + JU.DF.formatDecimal(freq, 2) + " cm-1 (" + JU.DF.formatDecimal(Float.parseFloat(data[1]), 0) + " km/Mole), " + activity); +}, "~N,~A"); +Clazz.defineMethod(c$, "readRaman", +function(ramanData){ +if (ramanData == null) { +ramanData = new JU.Lst(); +this.rd(); +while (this.rd() != null && !this.line.contains(" ")) ramanData.addLast(this.line); + +return ramanData; +}var info; +var i = 0; +var n = ramanData.size(); +for (; i < n; i++) { +this.line = ramanData.get(i); +if (this.line.contains("---")) break; +} +for (++i; i < n; i++) { +this.line = ramanData.get(i); +if (this.line.length == 0) break; +var mode1 = this.parseIntRange(this.line, 1, 5); +var mode2 = this.parseIntRange(this.line, 6, 10); +var i_tot = this.parseFloatRange(this.line, 30, 40); +var i_par = this.parseFloatRange(this.line, 40, 50); +var i_perp = this.parseFloatRange(this.line, 50, 60); +for (var i0 = 0, mode = mode1; mode <= mode2; mode++) { +var imodel = this.getModelForMode(i0, mode); +if (imodel < 0) continue; +i0 = imodel + 1; +info = this.asc.getAtomSetAuxiliaryInfoValue(imodel, "ramanInfo"); +if (info == null) this.asc.setModelInfoForSet("ramanInfo", info = new java.util.Hashtable(), imodel); +info.put("isotropicIntensities", Clazz.newFloatArray(-1, [i_tot, i_par, i_perp])); +} +} +for (; i < n; i++) { +this.line = ramanData.get(i); +if (this.line.contains("---")) break; +} +for (++i; i < n; i++) { +this.line = ramanData.get(i); +if (this.line.length == 0) break; +var mode1 = this.parseIntRange(this.line, 1, 5); +var mode2 = this.parseIntRange(this.line, 6, 10); +var i_xx = this.parseFloatRange(this.line, 30, 38); +var i_xy = this.parseFloatRange(this.line, 38, 46); +var i_xz = this.parseFloatRange(this.line, 46, 54); +var i_yy = this.parseFloatRange(this.line, 54, 62); +var i_yz = this.parseFloatRange(this.line, 62, 70); +var i_zz = this.parseFloatRange(this.line, 70, 78); +for (var i0 = 0, mode = mode1; mode <= mode2; mode++) { +var imodel = this.getModelForMode(i0, mode); +if (imodel < 0) continue; +i0 = imodel + 1; +var a = Clazz.newArray(-1, [ Clazz.newDoubleArray(-1, [i_xx, i_xy, i_xz]), Clazz.newDoubleArray(-1, [i_xy, i_yy, i_yz]), Clazz.newDoubleArray(-1, [i_xz, i_yz, i_zz])]); +this.asc.atoms[this.asc.getAtomSetAtomIndex(imodel)].addTensor( new JU.Tensor().setFromAsymmetricTensor(a, "raman", "mode" + mode), "raman", false); +} +} +this.appendLoadNote("Ellipsoids set \"raman\": Raman tensors"); +return null; +}, "JU.Lst"); +Clazz.defineMethod(c$, "getModelForMode", +function(i0, mode){ +var n = this.asc.atomSetCount; +for (var i = i0; i < n; i++) { +var imode = this.asc.getAtomSetAuxiliaryInfoValue(i, "vibrationalMode"); +var m = (imode == null ? 0 : imode.intValue()); +if (m == mode) return i; +} +return -1; +}, "~N,~N"); +Clazz.defineMethod(c$, "readGradient", +function(){ +var key = null; +while (this.line != null) { +var tokens = this.getTokens(); +if (this.line.indexOf("MAX GRAD") >= 0) key = "maxGradient"; + else if (this.line.indexOf("RMS GRAD") >= 0) key = "rmsGradient"; + else if (this.line.indexOf("MAX DISP") >= 0) key = "maxDisplacement"; + else if (this.line.indexOf("RMS DISP") >= 0) key = "rmsDisplacement"; + else break; +if (this.asc.ac > 0) this.asc.setAtomSetModelProperty(key, tokens[2]); +this.rd(); +} +return true; +}); +Clazz.defineMethod(c$, "readData", +function(name, nfields){ +this.processCoordLines(); +var f = Clazz.newFloatArray (this.ac, 0); +for (var i = 0; i < this.ac; i++) f[i] = 0; + +var data = ""; +while (this.rd() != null && (this.line.length < 4 || JU.PT.isDigit(this.line.charAt(3)))) data += this.line; + +data = JU.PT.rep(data, "-", " -"); +var tokens = JU.PT.getTokens(data); +for (var i = 0, pt = nfields - 1; i < this.ac; i++, pt += nfields) { +var iConv = this.getAtomIndexFromPrimitiveIndex(i); +if (iConv >= 0) f[iConv] = this.parseFloatStr(tokens[pt]); +} +this.asc.setAtomProperties(name, f, -1, false); +return true; +}, "~S,~N"); +Clazz.defineMethod(c$, "getQuadrupoleTensors", +function(){ +this.readLines(6); +var atoms = this.asc.atoms; +var vectors = new Array(3); +if (this.directLatticeVectors == null) vectors = Clazz.newArray(-1, [JU.V3.new3(1, 0, 0), JU.V3.new3(0, 1, 0), JU.V3.new3(0, 0, 1)]); + else for (var i = 0; i < 3; i++) { +vectors[i] = JU.V3.newV(this.directLatticeVectors[i]); +vectors[i].normalize(); +} +while (this.rd() != null && this.line.startsWith(" *** ATOM")) { +var tokens = this.getTokens(); +var index = this.parseIntStr(tokens[3]) - 1; +tokens = JU.PT.getTokens(this.readLines(3)); +atoms[index].addTensor( new JU.Tensor().setFromEigenVectors(vectors, Clazz.newFloatArray(-1, [this.parseFloatStr(tokens[1]), this.parseFloatStr(tokens[3]), this.parseFloatStr(tokens[5])]), "quadrupole", atoms[index].atomName, null), null, false); +this.rd(); +} +this.appendLoadNote("Ellipsoids set \"quadrupole\": Quadrupole tensors"); +return true; +}); +Clazz.defineMethod(c$, "readBornChargeTensors", +function(){ +this.processCoordLines(); +this.rd(); +var atoms = this.asc.atoms; +while (this.rd().startsWith(" ATOM")) { +var index = this.parseIntAt(this.line, 5) - 1; +var atom = atoms[index]; +this.readLines(2); +atom.addTensor( new JU.Tensor().setFromAsymmetricTensor(this.fill3x3(null, -3), "charge", atom.elementSymbol + (index + 1)), null, false); +this.rd(); +} +this.appendLoadNote("Ellipsoids set \"charge\": Born charge tensors"); +return false; +}); +c$.crtypes = Clazz.newArray(-1, ["??", "nuclei", "bonds", "rings", "cages"]); +c$.smap = Clazz.newIntArray(-1, [2, 3, 4, 11, 5, 6, 7, 12, 8, 9, 10, 13]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/DmolReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/DmolReader.js new file mode 100755 index 000000000000..81be3a55e7a6 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/DmolReader.js @@ -0,0 +1,103 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.xtal.DmolReader", ["JU.DF", "$.PT", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.unitCellData = null; +this.totE = null; +this.geomOpt = false; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "DmolReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.overrideMethod(c$, "checkLine", +function(){ +if (this.line.contains("** GEOMETRY OPTIMIZATION IN DELOCALIZED COORDINATES **")) { +this.geomOpt = true; +} else if (this.line.contains("INCOOR, atomic coordinates")) { +this.geomOpt = false; +} else if (!this.geomOpt ? this.line.contains("$cell vectors") : this.line.contains("Lattice:")) { +this.readCellParam(); +} else if (!this.geomOpt ? this.line.contains("$coordinates") : this.line.contains("Input Coordinates")) { +this.readCoord(); +} else if (this.line.contains(" Total Energy")) { +this.readEnergy(); +} else if (this.line.contains("Frequencies (cm-1)")) { +this.readFreq(); +}return true; +}); +Clazz.defineMethod(c$, "readCellParam", +function(){ +this.unitCellData = Clazz.newFloatArray (9, 0); +for (var n = 0, i = 0; n < 3; n++) { +var tokens = JU.PT.getTokens(this.rd()); +this.unitCellData[i++] = this.parseFloatStr(!this.geomOpt ? tokens[0] : tokens[4]) * 0.5291772; +this.unitCellData[i++] = this.parseFloatStr(!this.geomOpt ? tokens[1] : tokens[5]) * 0.5291772; +this.unitCellData[i++] = this.parseFloatStr(!this.geomOpt ? tokens[2] : tokens[6]) * 0.5291772; +} +}); +Clazz.defineMethod(c$, "newAtomSet", +function(){ +this.applySymmetryAndSetTrajectory(); +this.asc.newAtomSet(); +if (this.totE != null) this.setEnergy(); +this.doApplySymmetry = true; +if (this.unitCellData != null) { +this.addExplicitLatticeVector(0, this.unitCellData, 0); +this.addExplicitLatticeVector(1, this.unitCellData, 3); +this.addExplicitLatticeVector(2, this.unitCellData, 6); +this.setSpaceGroupName("P1"); +}this.setFractionalCoordinates(false); +}); +Clazz.defineMethod(c$, "readCoord", +function(){ +this.newAtomSet(); +if (this.geomOpt) this.readLines(2); +while (this.rd() != null && !this.geomOpt ? !this.line.contains("$end") : !this.line.contains("-----")) { +var tokens = this.getTokens(); +var atom = this.asc.addNewAtom(); +atom.atomName = !this.geomOpt ? tokens[0] : tokens[1]; +var factor = (!this.geomOpt ? 0.5291772 : 1.00); +var x = this.parseFloatStr(!this.geomOpt ? tokens[1] : tokens[2]) * factor; +var y = this.parseFloatStr(!this.geomOpt ? tokens[2] : tokens[3]) * factor; +var z = this.parseFloatStr(!this.geomOpt ? tokens[3] : tokens[4]) * factor; +atom.set(x, y, z); +this.setAtomCoord(atom); +} +}); +Clazz.defineMethod(c$, "readEnergy", +function(){ +this.rd(); +if (this.line.contains("Ef")) this.totE = Double.$valueOf(Double.parseDouble(JU.PT.getTokens(this.line.substring(this.line.indexOf("Ef") + 1, this.line.indexOf("Ha")))[1])); +}); +Clazz.defineMethod(c$, "setEnergy", +function(){ +this.asc.setAtomSetEnergy("" + this.totE, this.totE.floatValue()); +this.asc.setInfo("Energy", this.totE); +this.asc.setAtomSetName("E = " + this.totE + " Hartree"); +}); +Clazz.defineMethod(c$, "readFreq", +function(){ +var lastAtomCount = 0; +var ac = this.asc.getLastAtomSetAtomCount(); +while (this.rd() != null && this.line.charAt(1) == ' ') { +var tokens = this.getTokens(); +var frequencyCount = Clazz.doubleToInt(tokens.length / 2); +var frequencies = Clazz.newFloatArray (frequencyCount, 0); +for (var i = 1, n = 0; i < tokens.length; i += 2, n++) { +frequencies[n] = this.parseFloatStr(tokens[i]); +if (this.debugging) JU.Logger.debug((this.vibrationNumber + n) + " frequency=" + frequencies[n]); +} +var ignore = Clazz.newBooleanArray(frequencyCount, false); +var iAtom0 = 0; +for (var i = 0; i < frequencyCount; i++) { +ignore[i] = (!this.doGetVibration(++this.vibrationNumber)); +if (ignore[i]) continue; +this.applySymmetryAndSetTrajectory(); +lastAtomCount = this.cloneLastAtomSet(ac, null); +if (i == 0) iAtom0 = this.asc.getLastAtomSetAtomIndex(); +this.asc.setAtomSetFrequency(this.vibrationNumber, null, null, String.valueOf(frequencies[i]), null); +this.asc.setAtomSetName(JU.DF.formatDecimal(frequencies[i], 2) + " cm-1"); +} +this.rd(); +this.fillFrequencyData(iAtom0, ac, lastAtomCount, ignore, false, 5, 13, null, 0, null); +this.readLines(2); +} +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/EspressoReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/EspressoReader.js new file mode 100755 index 000000000000..ff0cfae55eda --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/EspressoReader.js @@ -0,0 +1,102 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.xtal.EspressoReader", ["JU.PT"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.cellParams = null; +this.totEnergy = null; +this.endFlag = false; +this.aPar = 0; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "EspressoReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.setSpaceGroupName("P1"); +this.doApplySymmetry = true; +}); +Clazz.overrideMethod(c$, "checkLine", +function(){ +if (this.line.contains("lattice parameter (a_0)") || this.line.contains("lattice parameter (alat)")) { +this.readAparam(); +} else if (this.line.contains("crystal axes:")) { +this.readCellParam(false); +} else if (this.line.contains("CELL_PARAMETERS (")) { +this.readCellParam(true); +} else if (this.line.contains("Cartesian axes")) { +this.discardLinesUntilContains("positions ("); +if (this.doGetModel(++this.modelNumber, null)) this.readAtoms(); +} else if (this.line.contains("POSITIONS (")) { +if (this.doGetModel(++this.modelNumber, null)) this.readAtoms(); +} else if (this.line.contains("! total energy")) { +this.readEnergy(); +} else if (this.line.contains("A final scf")) { +this.endFlag = true; +}return true; +}); +Clazz.defineMethod(c$, "readAparam", +function(){ +this.aPar = this.parseFloatStr(this.getTokens()[4]) * 0.5291772; +}); +Clazz.defineMethod(c$, "readCellParam", +function(andAPar){ +var i0 = (andAPar ? 0 : 3); +if (this.line.contains("bohr")) this.aPar = 0.5291772; +if (andAPar && this.line.contains("=")) this.aPar = this.parseFloatStr(this.line.substring(this.line.indexOf("=") + 1)) * 0.5291772; +this.cellParams = Clazz.newFloatArray (9, 0); +for (var n = 0, i = 0; n < 3; n++) { +var tokens = JU.PT.getTokens(this.rd()); +this.cellParams[i++] = this.parseFloatStr(tokens[i0]) * this.aPar; +this.cellParams[i++] = this.parseFloatStr(tokens[i0 + 1]) * this.aPar; +this.cellParams[i++] = this.parseFloatStr(tokens[i0 + 2]) * this.aPar; +} +}, "~B"); +Clazz.defineMethod(c$, "newAtomSet", +function(){ +this.asc.newAtomSet(); +if (this.totEnergy != null) this.setEnergy(); +}); +Clazz.defineMethod(c$, "setCellParams", +function(){ +if (this.cellParams != null) { +this.addExplicitLatticeVector(0, this.cellParams, 0); +this.addExplicitLatticeVector(1, this.cellParams, 3); +this.addExplicitLatticeVector(2, this.cellParams, 6); +this.setSpaceGroupName("P1"); +}}); +Clazz.defineMethod(c$, "readAtoms", +function(){ +this.newAtomSet(); +var isAlat = (this.line.contains("alat") || this.line.contains("a_0")); +var firstStr = (this.line.contains("site n.")); +var isFractional = this.line.contains("crystal"); +var isBohr = this.line.contains("bohr"); +var isAngstrom = this.line.contains("angstrom"); +if (isAlat || isFractional || isAngstrom) this.setCellParams(); +this.setFractionalCoordinates(isFractional); +while (this.rd() != null && this.line.length > 45) { +var tokens = this.getTokens(); +var atom = this.asc.addNewAtom(); +atom.atomName = tokens[(isBohr || tokens.length == 4 || !firstStr ? 0 : 1)]; +var i1 = (isBohr || tokens.length == 4 || !firstStr ? 1 : tokens.length - 4); +var x = this.parseFloatStr(tokens[i1++]); +var y = this.parseFloatStr(tokens[i1++]); +var z = this.parseFloatStr(tokens[i1++]); +atom.set(x, y, z); +if (isBohr) { +atom.scale(0.5291772); +} else if (isAlat) { +atom.scale(this.aPar); +}this.setAtomCoord(atom); +} +this.applySymmetryAndSetTrajectory(); +if (this.endFlag) this.discardLinesUntilContains("Harris-Foulkes estimate"); +}); +Clazz.defineMethod(c$, "readEnergy", +function(){ +this.totEnergy = Double.$valueOf(Double.parseDouble(JU.PT.getTokens(this.line.substring(this.line.indexOf("=") + 1))[0])); +}); +Clazz.defineMethod(c$, "setEnergy", +function(){ +this.asc.setAtomSetEnergy("" + this.totEnergy, this.totEnergy.floatValue()); +this.asc.setInfo("Energy", this.totEnergy); +this.asc.setAtomSetName("E = " + this.totEnergy + " Ry"); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/GulpReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/GulpReader.js new file mode 100755 index 000000000000..9c565bdb199f --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/GulpReader.js @@ -0,0 +1,247 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.xtal.GulpReader", ["java.util.Hashtable", "JU.PT", "$.V3"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.isSlab = false; +this.isPolymer = false; +this.$isPrimitive = false; +this.sep = "-------"; +this.coordinatesArePrimitive = false; +this.atomCharges = null; +this.bTest = false; +this.a = 0; +this.b = 0; +this.c = 0; +this.alpha = 0; +this.beta = 0; +this.gamma = 0; +this.primitiveData = null; +this.totEnergy = null; +this.energyUnits = null; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "GulpReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.$isPrimitive = !this.checkFilterKey("CONV"); +this.coordinatesArePrimitive = true; +this.setFractionalCoordinates(this.readDimensionality()); +}); +Clazz.overrideMethod(c$, "finalizeSubclassReader", +function(){ +if (this.atomCharges == null) return; +var atoms = this.asc.atoms; +var f; +for (var i = this.asc.ac; --i >= 0; ) if ((f = this.atomCharges.get(atoms[i].atomName)) != null || (f = this.atomCharges.get(atoms[i].getElementSymbol())) != null) atoms[i].partialCharge = f.floatValue(); + +}); +Clazz.overrideMethod(c$, "checkLine", +function(){ +if (this.line.contains("Space group ")) { +this.readSpaceGroup(); +return true; +}if (this.isSlab ? this.line.contains("Surface cell parameters") : this.isPolymer ? this.line.contains("Polymer cell parameter") : (this.bTest = this.line.contains("Cartesian lattice vectors")) || this.line.contains("Cell parameters (Angstroms/Degrees)") || this.line.contains("Primitive cell parameters")) { +this.readCellParameters(this.bTest); +return true; +}if (this.line.contains("Monopole - monopole (total)")) { +this.readEnergy(); +return true; +}if (this.line.contains("Fractional coordinates of asymmetric unit :") || (this.bTest = this.line.contains("Final asymmetric unit coordinates")) || (this.bTest = this.line.contains("Final fractional coordinates ")) || this.line.contains("Mixed fractional/Cartesian coordinates") || this.line.contains("Cartesian coordinates of cluster ") || this.line.contains("Final cartesian coordinates of atoms :") && this.isMolecular) { +if (this.doGetModel(++this.modelNumber, null)) this.readAtomicPos(!this.bTest); +return true; +}if (this.line.contains("Species output for all configurations")) { +this.readPartialCharges(); +return true; +}if (!this.doProcessLines) return true; +if (this.line.contains("Final cell parameters and derivatives")) { +this.readFinalCell(); +return true; +}return true; +}); +Clazz.defineMethod(c$, "readDimensionality", +function(){ +this.discardLinesUntilContains("Dimensionality"); +var tokens = this.getTokens(); +switch (this.parseIntStr(tokens[2])) { +case 0: +this.isMolecular = true; +this.$isPrimitive = false; +return false; +case 1: +this.isPolymer = true; +this.$isPrimitive = false; +break; +case 2: +this.isSlab = true; +this.$isPrimitive = false; +break; +} +return true; +}); +Clazz.defineMethod(c$, "readSpaceGroup", +function(){ +this.sgName = this.line.substring(this.line.indexOf(":") + 1).trim(); +}); +c$.parameterIndex = Clazz.defineMethod(c$, "parameterIndex", +function(key){ +for (var i = J.adapter.readers.xtal.GulpReader.tags.length; --i >= 0; ) if (J.adapter.readers.xtal.GulpReader.tags[i].equals(key)) return i; + +return -1; +}, "~S"); +Clazz.defineMethod(c$, "setParameter", +function(key, value){ +switch (J.adapter.readers.xtal.GulpReader.parameterIndex(key)) { +case 0: +this.a = value; +break; +case 1: +this.b = value; +break; +case 2: +this.c = value; +break; +case 3: +this.alpha = value; +break; +case 4: +this.beta = value; +break; +case 5: +this.gamma = value; +break; +} +}, "~S,~N"); +Clazz.defineMethod(c$, "newAtomSet", +function(doSetUnitCell){ +this.asc.newAtomSet(); +if (doSetUnitCell) { +this.setModelParameters(this.coordinatesArePrimitive); +if (this.totEnergy != null) this.setEnergy(); +}}, "~B"); +Clazz.defineMethod(c$, "setModelParameters", +function(isPrimitive){ +if (this.sgName != null) this.setSpaceGroupName(isPrimitive ? "P1" : this.sgName); +if (isPrimitive && this.primitiveData != null) { +this.addExplicitLatticeVector(0, this.primitiveData, 0); +this.addExplicitLatticeVector(1, this.primitiveData, 3); +this.addExplicitLatticeVector(2, this.primitiveData, 6); +} else if (this.a != 0) { +if (this.isSlab) { +this.c = -1; +this.beta = this.gamma = 90; +} else if (this.isPolymer) { +this.b = this.c = -1; +this.alpha = this.beta = this.gamma = 90; +}this.setUnitCell(this.a, this.b, this.c, this.alpha, this.beta, this.gamma); +}}, "~B"); +Clazz.defineMethod(c$, "readCellParameters", +function(isLatticeVectors){ +if (isLatticeVectors) { +this.rd(); +this.primitiveData = this.fillFloatArray(null, 0, Clazz.newFloatArray (9, 0)); +this.a = 0; +return; +}var i0 = (this.line.indexOf("Full cell") < 0 ? 0 : 4); +this.coordinatesArePrimitive = (i0 == 0); +this.rd(); +while (this.rd() != null && this.line.contains("=")) { +var tokens = JU.PT.getTokens(this.line.$replace('=', ' ')); +for (var i = i0; i < i0 + 4; i += 2) if (tokens.length > i + 1) this.setParameter(tokens[i], this.parseFloatStr(tokens[i + 1])); + +} +}, "~B"); +Clazz.defineMethod(c$, "readFinalCell", +function(){ +this.discardLinesUntilContains(this.sep); +var tokens; +while (this.rd() != null && (tokens = this.getTokens()).length >= 2) this.setParameter(tokens[0], this.parseFloatStr(tokens[1])); + +if (this.primitiveData != null) { +this.scalePrimitiveData(0, this.a); +this.scalePrimitiveData(3, this.b); +this.scalePrimitiveData(6, this.c); +if (!this.coordinatesArePrimitive) while (this.rd() != null && this.line.indexOf("Final") < 0) if (this.line.indexOf("Non-primitive lattice parameters") > 0) { +this.rd(); +for (var i = 0; i < 2; i++) { +tokens = JU.PT.getTokens(this.rd().$replace('=', ' ')); +this.setParameter(tokens[0], this.parseFloatStr(tokens[1])); +this.setParameter(tokens[2], this.parseFloatStr(tokens[3])); +this.setParameter(tokens[4], this.parseFloatStr(tokens[5])); +} +break; +} +}this.setModelParameters(this.coordinatesArePrimitive); +this.applySymmetryAndSetTrajectory(); +if (this.totEnergy != null) this.setEnergy(); +}); +Clazz.defineMethod(c$, "scalePrimitiveData", +function(i, value){ +var v = JU.V3.new3(this.primitiveData[i], this.primitiveData[i + 1], this.primitiveData[i + 2]); +v.normalize(); +v.scale(value); +this.primitiveData[i++] = v.x; +this.primitiveData[i++] = v.y; +this.primitiveData[i++] = v.z; +}, "~N,~N"); +Clazz.overrideMethod(c$, "applySymmetryAndSetTrajectory", +function(){ +if (this.coordinatesArePrimitive && this.iHaveUnitCell && this.doCheckUnitCell && this.primitiveData != null && !this.$isPrimitive) { +this.setModelParameters(false); +var symFull = this.symmetry; +this.setModelParameters(true); +var atoms = this.asc.atoms; +var i0 = this.asc.getLastAtomSetAtomIndex(); +var i1 = this.asc.ac; +for (var i = i0; i < i1; i++) { +var atom = atoms[i]; +this.symmetry.toCartesian(atom, true); +symFull.toFractional(atom, true); +this.fixFloatPt(atom, 100000.0); +} +this.setModelParameters(false); +}this.applySymTrajASCR(); +}); +Clazz.defineMethod(c$, "readAtomicPos", +function(finalizeSymmetry){ +this.newAtomSet(finalizeSymmetry); +this.discardLinesUntilContains(this.sep); +this.discardLinesUntilContains(this.sep); +while (this.rd() != null) { +if (this.line.indexOf(this.sep) >= 0 && this.rd().indexOf("Region") < 0) break; +if (this.line.indexOf("Region") >= 0) { +this.rd(); +continue; +}this.line = this.line.$replace('*', ' '); +var tokens = this.getTokens(); +if (tokens[2].equals("c")) this.addAtomXYZSymName(tokens, 3, null, tokens[1]); +} +if (finalizeSymmetry) this.applySymmetryAndSetTrajectory(); +}, "~B"); +Clazz.defineMethod(c$, "readPartialCharges", +function(){ +this.atomCharges = new java.util.Hashtable(); +this.discardLinesUntilContains(this.sep); +this.discardLinesUntilContains(this.sep); +var tokens; +while ((tokens = JU.PT.getTokens(this.rd())).length > 5) { +var species = tokens[0]; +var charge = this.atomCharges.get(species); +var f = (charge == null ? 0 : charge.floatValue()); +this.atomCharges.put(species, Float.$valueOf((f + this.parseFloatStr(tokens[4])))); +} +}); +Clazz.defineMethod(c$, "readEnergy", +function(){ +if (this.line.indexOf("=") < 0) this.discardLinesUntilContains("="); +var tokens = JU.PT.getTokens(this.line.substring(this.line.indexOf("="))); +this.totEnergy = Double.$valueOf(Double.parseDouble(tokens[1])); +this.energyUnits = tokens[2]; +this.discardLinesUntilContains(this.sep); +}); +Clazz.defineMethod(c$, "setEnergy", +function(){ +this.asc.setAtomSetEnergy("" + this.totEnergy, this.totEnergy.floatValue()); +this.asc.setInfo("Energy", this.totEnergy); +this.asc.setAtomSetName("E = " + this.totEnergy + " " + this.energyUnits); +this.totEnergy = null; +}); +c$.tags = Clazz.newArray(-1, ["a", "b", "c", "alpha", "beta", "gamma"]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/JanaReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/JanaReader.js new file mode 100755 index 000000000000..ba33c09fa562 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/JanaReader.js @@ -0,0 +1,562 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.xtal.JanaReader", ["java.util.Hashtable", "JU.A4", "$.BS", "$.Lst", "$.Matrix", "$.P3", "$.PT", "$.Quat", "$.Rdr", "$.V3", "J.adapter.smarter.Atom", "J.api.Interface", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.lattvecs = null; +this.thisSub = 0; +this.modAxes = null; +this.haveM40Data = false; +this.qicount = 0; +this.molName = null; +this.molAtoms = null; +this.molTtypes = null; +this.modelMolecule = null; +this.molHasTLS = false; +this.matR = null; +this.rho = null; +this.firstPosition = false; +this.vR = null; +this.v0Cart = null; +this.isLegendre = false; +this.floats = null; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "JanaReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.prepareFields (c$, function(){ +this.floats = Clazz.newFloatArray (6, 0); +}); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.modAxes = this.getFilter("MODAXES="); +this.setFractionalCoordinates(true); +this.asc.newAtomSet(); +this.asc.setCurrentModelInfo("autoBondUsingOccupation", Boolean.TRUE); +}); +Clazz.overrideMethod(c$, "checkLine", +function(){ +if (this.line.length < 3) return true; +JU.Logger.info(this.line); +this.parseTokenStr(this.line); +switch ("tit cell ndim qi lat sym spg end wma".indexOf(this.line.substring(0, 3))) { +case 0: +this.asc.setAtomSetName(this.line.substring(5).trim()); +break; +case 5: +this.cell(); +this.setSymmetryOperator("x,y,z"); +break; +case 10: +this.ndim(); +break; +case 20: +if (this.lattvecs == null) this.lattvecs = new JU.Lst(); +if (!this.ms.addLatticeVector(this.lattvecs, this.line.substring(8))) this.appendLoadNote(this.line + " not supported"); +break; +case 30: +this.setSpaceGroupName(this.getTokens()[1]); +break; +case 25: +this.symmetry(); +break; +case 15: +this.qi(); +break; +case 35: +while (this.rd() != null) { +if (this.line.startsWith("command") || this.parseIntStr(this.line) >= 0) { +this.readM40Data(true); +break; +}} +this.continuing = false; +break; +case 40: +var n = 3 + this.modDim; +var m; +if (this.thisSub++ == 0) { +m = JU.Matrix.identity(n, n); +this.ms.addSubsystem("" + this.thisSub++, m); +}m = new JU.Matrix(null, n, n); +var a = m.getArray(); +var data = Clazz.newFloatArray (n * n, 0); +this.fillFloatArray(null, 0, data); +for (var i = 0, pt = 0; i < n; i++) for (var j = 0; j < n; j++, pt++) a[i][j] = data[pt]; + + +this.ms.addSubsystem("" + this.thisSub, m); +} +return true; +}); +Clazz.overrideMethod(c$, "doPreSymmetry", +function(){ +if (this.ms != null) this.ms.setModulation(false, null); +if (this.vibsFractional) this.asc.getXSymmetry().scaleFractionalVibs(); +}); +Clazz.overrideMethod(c$, "finalizeSubclassReader", +function(){ +if (!this.haveM40Data) this.readM40Data(false); +if (this.lattvecs != null && this.lattvecs.size() > 0) this.asc.getSymmetry().addLatticeVectors(this.lattvecs); +this.applySymmetryAndSetTrajectory(); +this.finalizeReaderASCR(); +}); +Clazz.overrideMethod(c$, "finalizeSubclassSymmetry", +function(haveSymmetry){ +this.adjustM40Occupancies(); +if (this.ms != null && haveSymmetry) { +this.ms.setModulation(true, this.asc.getXSymmetry().getBaseSymmetry()); +this.ms.finalizeModulation(); +}}, "~B"); +Clazz.defineMethod(c$, "cell", +function(){ +for (var ipt = 0; ipt < 6; ipt++) this.setUnitCellItem(ipt, this.parseFloat()); + +}); +Clazz.defineMethod(c$, "ndim", +function(){ +this.ms = J.api.Interface.getOption("adapter.readers.cif.MSRdr", this.vwr, "file"); +this.modDim = this.ms.initialize(this, (this.parseIntStr(this.getTokens()[1]) - 3)); +}); +Clazz.defineMethod(c$, "qi", +function(){ +var pt = Clazz.newDoubleArray (this.modDim, 0); +pt[this.qicount] = 1; +var a = Clazz.newDoubleArray(-1, [this.parseFloat(), this.parseFloat(), this.parseFloat()]); +this.parseTokenStr(this.rd()); +for (var i = 0; i < 3; i++) a[i] += this.parseFloat(); + +this.ms.addModulation(null, "W_" + (++this.qicount), a, -1); +this.ms.addModulation(null, "F_" + this.qicount + "_coefs_", pt, -1); +}); +Clazz.defineMethod(c$, "symmetry", +function(){ +this.setSymmetryOperator(JU.PT.rep(this.line.substring(9).trim(), " ", ",")); +}); +Clazz.defineMethod(c$, "readM40Data", +function(haveReader){ +if (haveReader) { +this.parseM40Floats(); +} else { +var m40File = this.filePath; +var ipt = m40File.lastIndexOf("."); +if (ipt < 0) return; +m40File = m40File.substring(0, ipt + 2) + "40"; +var id = m40File.substring(0, ipt); +this.reader.close(); +this.reader = JU.Rdr.getBR(this.vwr.getLigandModel(id, m40File, "_file", "----")); +if (this.out != null) this.out.append("******************************* M40 DATA *******************************\n"); +this.readM40Floats(); +}this.haveM40Data = true; +if (this.line.startsWith("command")) this.readM40WaveVectors(); +var nFree = 0; +var nGroups = 0; +var isAxial = false; +var newSub = (this.thisSub == 0 ? null : new JU.BS()); +var iSub = (this.thisSub == 0 ? 1 : this.thisSub); +for (var i = 0, n = 0, pt = 0; i < iSub; i++, pt += 10) { +nFree = this.getInt(pt, pt + 5); +nGroups = this.getInt(pt + 5, pt + 10); +isAxial = (this.getInt(pt + 15, pt + 20) == 1); +if (nGroups != 0 && i > 0) { +throw new Exception("Jmol cannot read rigid body M40 files for composites"); +}if (newSub != null) newSub.set(n = n + nFree); +} +iSub = (newSub == null ? 0 : 1); +var nAtoms = -1; +var refAtomName = null; +this.rho = null; +if (nGroups > 0) { +JU.Logger.info("JanaReader found " + nFree + " free atoms and " + nGroups + " groups"); +this.molName = null; +this.molAtoms = new JU.Lst(); +this.molTtypes = new JU.Lst(); +}while (this.skipToNextAtom() != null) { +nAtoms++; +var atom = new J.adapter.smarter.Atom(); +JU.Logger.info(this.line); +var name = this.line.substring(0, 9).trim(); +atom.atomName = name; +var isRefAtom = name.equals(refAtomName); +atom.foccupancy = this.floats[2]; +var isJanaMolecule = Float.isNaN(atom.foccupancy); +if (isJanaMolecule) { +var pointGroup = this.getStr(12, 18); +if (pointGroup.length > 0 && !pointGroup.equals("1")) { +throw new Exception("Jmol cannot process M40 files with molecule positions based on point-group symmetry."); +}refAtomName = null; +if (Float.isNaN(this.floats[4])) refAtomName = this.getStr(28, 37); + else this.rho = JU.P3.new3(this.floats[3], this.floats[4], this.floats[5]); +this.molName = name; +this.molAtoms.clear(); +this.molTtypes.clear(); +this.molHasTLS = false; +this.firstPosition = true; +this.modelMolecule = new JU.Lst(); +continue; +}var isExcluded = false; +var posName = (name.startsWith("pos#") ? name : null); +if (posName == null) { +if (!this.filterAtom(atom, 0)) { +if (!isRefAtom) continue; +isExcluded = true; +}this.setAtomCoordXYZ(atom, this.floats[3], this.floats[4], this.floats[5]); +if (isRefAtom) { +this.rho = JU.P3.newP(atom); +if (isExcluded) continue; +}this.asc.addAtom(atom); +if (iSub > 0) { +if (newSub.get(nAtoms)) iSub++; +atom.altLoc = ("" + iSub).charAt(0); +}this.readAtomRecord(atom, null, null, false); +if (this.molAtoms != null) this.molAtoms.addLast(atom); +} else { +if (this.molAtoms.size() == 0) continue; +this.processPosition(posName, atom, isAxial); +}} +}, "~B"); +Clazz.defineMethod(c$, "getInt", +function(col1, col2){ +var n = this.line.length; +return (n > col1 ? this.parseIntStr(this.getStr(col1, col2)) : 0); +}, "~N,~N"); +Clazz.defineMethod(c$, "getStr", +function(col1, col2){ +var n = this.line.length; +return (n > col1 ? this.line.substring(col1, Math.min(n, col2)).trim() : ""); +}, "~N,~N"); +Clazz.defineMethod(c$, "getFlag", +function(i){ +return (this.getInt(i, i + 1) > 0); +}, "~N"); +Clazz.defineMethod(c$, "skipToNextAtom", +function(){ +while (this.readM40Floats() != null && (this.line.length == 0 || this.line.charAt(0) == ' ' || this.line.charAt(0) == '-')) { +} +return this.line; +}); +Clazz.defineMethod(c$, "readM40WaveVectors", +function(){ +while (!this.readM40Floats().contains("end")) if (this.line.startsWith("wave")) { +var tokens = this.getTokens(); +var pt = Clazz.newDoubleArray (this.modDim, 0); +for (var i = 0; i < this.modDim; i++) pt[i] = this.parseFloatStr(tokens[i + 2]); + +this.ms.addModulation(null, "F_" + this.parseIntStr(tokens[1]) + "_coefs_", pt, -1); +} +this.readM40Floats(); +}); +Clazz.defineMethod(c$, "processPosition", +function(posName, pos, isAxial){ +pos.atomName = this.molName + "_" + posName; +var isImproper = (this.getInt(9, 11) == -1); +var systType = this.getInt(13, 14); +var rm = (systType == 0 ? null : new JU.P3()); +var rp = (systType == 0 ? null : new JU.P3()); +if (systType != 0) { +throw new Exception("Jmol can only read rigid body groups with basic crystallographic settings."); +}var rotData = this.readAtomRecord(pos, rm, rp, true); +var name = pos.atomName; +var n = this.molAtoms.size(); +JU.Logger.info(name + " Molecular group " + this.molName + " has " + n + " atoms"); +var ext = "_" + posName.substring(4); +var vTrans = JU.V3.new3(pos.anisoBorU[3], pos.anisoBorU[4], pos.anisoBorU[5]); +var phi = JU.Quat.newAA(JU.A4.newVA(JU.V3.new3(0, 0, 1), (pos.anisoBorU[0] / 180 * 3.141592653589793))); +var chi = JU.Quat.newAA(JU.A4.newVA(isAxial ? JU.V3.new3(0, 1, 0) : JU.V3.new3(1, 0, 0), (pos.anisoBorU[1] / 180 * 3.141592653589793))); +var psi = JU.Quat.newAA(JU.A4.newVA(isAxial ? JU.V3.new3(1, 0, 0) : JU.V3.new3(0, 0, 1), (pos.anisoBorU[2] / 180 * 3.141592653589793))); +this.matR = phi.mulQ(chi).mulQ(psi).getMatrix(); +if (isImproper) this.matR.scale(-1); +var script = ""; +for (var i = 0; i < n; i++) { +var a = this.molAtoms.get(i); +var newName = a.atomName; +script += ", " + newName; +if (this.firstPosition) { +newName += ext; +this.modelMolecule.addLast(JU.P3.newP(a)); +} else { +a = this.asc.newCloneAtom(a); +newName = newName.substring(0, newName.lastIndexOf("_")) + ext; +}a.atomName = newName; +var v0 = JU.V3.newVsub(this.modelMolecule.get(i), this.rho); +this.getSymmetry().toCartesian(this.v0Cart = JU.V3.newV(v0), true); +this.vR = JU.V3.newV(v0); +this.cartesianProduct(this.vR, null); +a.setT(this.rho); +a.add(vTrans); +a.add(this.vR); +this.copyModulations(";" + pos.atomName, ";" + newName); +if (rotData != null) this.setRigidBodyRotations(";" + newName, rotData); +} +this.firstPosition = false; +script = "@" + this.molName + ext + script.substring(1); +this.addJmolScript(script); +this.appendLoadNote(script); +}, "~S,J.adapter.smarter.Atom,~B"); +Clazz.defineMethod(c$, "cartesianProduct", +function(vA, vB){ +this.symmetry.toCartesian(vA, true); +if (vB == null) this.matR.rotate2(vA, vA); + else vA.cross(vA, vB); +this.symmetry.toFractional(vA, true); +}, "JU.T3,JU.T3"); +Clazz.defineMethod(c$, "readAtomRecord", +function(atom, rm, rp, isPos){ +var label = ";" + atom.atomName; +var tType = (isPos ? -1 : this.getInt(13, 14)); +if (!isPos && this.molTtypes != null) this.molTtypes.addLast(Integer.$valueOf(tType)); +var haveSpecialOcc = this.getFlag(60); +var haveSpecialDisp = this.getFlag(61); +var haveSpecialUij = this.getFlag(62); +var nOcc = this.getInt(65, 68); +var nDisp = this.getInt(68, 71); +var nUij = this.getInt(71, 74); +if (rm != null) { +this.readM40Floats(); +rm.set(this.floats[0], this.floats[1], this.floats[2]); +rp.set(this.floats[3], this.floats[4], this.floats[5]); +}if (tType > 2) this.readM40Floats(); +this.readM40Floats(); +switch (tType) { +case 6: +case 5: +case 4: +case 3: +this.readLines(tType - 1); +this.appendLoadNote("Skipping temperature factors with order > 2"); +case 2: +case -1: +for (var j = 0; j < 6; j++) this.asc.setU(atom, j, this.floats[j]); + +break; +case 1: +if (this.floats[0] != 0) this.asc.setU(atom, 7, this.floats[0]); +break; +case 0: +this.molHasTLS = true; +this.appendLoadNote("Jmol cannot process molecular TLS parameters"); +break; +} +if (this.modDim == 0) return null; +if (isPos && this.molHasTLS) this.readLines(4); +var pt; +var o_0 = (nOcc > 0 && !haveSpecialOcc ? this.parseFloatStr(this.rd()) : 1); +if (o_0 != 1) this.ms.addModulation(null, "J_O#0" + label, Clazz.newDoubleArray(-1, [atom.foccupancy, o_0, 0]), -1); +atom.foccupancy *= o_0; +var wv = 0; +var a1; +var a2; +this.isLegendre = false; +for (var j = 0; j < nOcc; j++) { +if (haveSpecialOcc) { +var data = this.readM40FloatLines(2, 1); +a2 = data[0][0]; +a1 = data[1][0]; +} else { +wv = j + 1; +this.readM40Floats(); +a1 = this.floats[0]; +a2 = this.floats[1]; +}pt = Clazz.newDoubleArray(-1, [a1, a2, 0]); +if (a1 != 0 || a2 != 0) this.ms.addModulation(null, "O_" + wv + "#0" + label, pt, -1); +} +for (var j = 0; j < nDisp; j++) { +if (haveSpecialDisp) { +this.readM40Floats(); +var c = this.floats[3]; +var w = this.floats[4]; +for (var k = 0; k < 3; k++) if (this.floats[k] != 0) this.ms.addModulation(null, "D_S#" + J.adapter.readers.xtal.JanaReader.XYZ[k] + label, Clazz.newDoubleArray(-1, [c, w, this.floats[k]]), -1); + +} else { +this.addSinCos(j, "D_", label, isPos); +}} +var rotData = (isPos && nDisp > 0 ? this.readM40FloatLines(nDisp, 6) : null); +if (!isPos) { +if (this.isLegendre) nUij *= 2; +for (var j = 0; j < nUij; j++) { +if (tType == 1) { +this.addSinCos(j, "U_", label, false); +} else { +if (haveSpecialUij) { +JU.Logger.error("JanaReader -- not interpreting SpecialUij flag: " + this.line); +} else if (this.isLegendre) { +var data = this.readM40FloatLines(1, 6); +var order = j + 1; +var coeff = 0; +for (var k = 0, p = 0; k < 6; k++, p += 3) { +if ((coeff = data[0][k]) != 0) this.ms.addModulation(null, "U_L" + order + "#" + "U11U22U33U12U13U23UISO".substring(p, p + 3) + label, Clazz.newDoubleArray(-1, [coeff, order, 0]), -1); +} +} else { +var data = this.readM40FloatLines(2, 6); +for (var k = 0, p = 0; k < 6; k++, p += 3) { +var csin = data[1][k]; +var ccos = data[0][k]; +this.ms.addModulation(null, "U_" + (j + 1) + "#" + "U11U22U33U12U13U23UISO".substring(p, p + 3) + label, Clazz.newDoubleArray(-1, [csin, ccos, 0]), -1); +} +}}} +}return rotData; +}, "J.adapter.smarter.Atom,JU.P3,JU.P3,~B"); +Clazz.defineMethod(c$, "addSinCos", +function(j, key, label, isPos){ +this.readM40Floats(); +if (this.isLegendre) { +for (var i = 0; i < 2; i++) { +var order = (j * 2 + i + 1); +for (var k = 0; k < 3; ++k) { +var coeff = this.floats[3 * i + k]; +if (coeff == 0) { +continue; +}var axis = J.adapter.readers.xtal.JanaReader.XYZ[k % 3]; +if (this.modAxes != null && this.modAxes.indexOf(axis.toUpperCase()) < 0) continue; +var id = key + "L#" + axis + order + label; +this.ms.addModulation(null, id, Clazz.newDoubleArray(-1, [coeff, order, 0]), -1); +} +} +return; +}this.ensureFourier(j); +for (var k = 0; k < 3; ++k) { +var csin = this.floats[k]; +var ccos = this.floats[k + 3]; +if (csin == 0 && ccos == 0) { +if (!isPos) continue; +csin = 1e-10; +}var axis = J.adapter.readers.xtal.JanaReader.XYZ[k % 3]; +if (this.modAxes != null && this.modAxes.indexOf(axis.toUpperCase()) < 0) continue; +var id = key + (j + 1) + "#" + axis + label; +this.ms.addModulation(null, id, Clazz.newDoubleArray(-1, [csin, ccos, 0]), -1); +} +}, "~N,~S,~S,~B"); +Clazz.defineMethod(c$, "ensureFourier", +function(j){ +var pt; +if (j > 0 && this.ms.getMod("F_" + (++j) + "_coefs_") == null && (pt = this.ms.getMod("F_1_coefs_")) != null) { +var p = Clazz.newDoubleArray (this.modDim, 0); +for (var i = this.modDim; --i >= 0; ) p[i] = pt[i] * j; + +this.ms.addModulation(null, "F_" + j + "_coefs_", p, -1); +}}, "~N"); +Clazz.defineMethod(c$, "readM40Floats", +function(){ +if ((this.line = this.rd()) == null || this.line.indexOf("-------") >= 0) return (this.line = null); +if (this.debugging) JU.Logger.debug(this.line); +this.parseM40Floats(); +return this.line; +}); +Clazz.defineMethod(c$, "parseM40Floats", +function(){ +var ptLast = this.line.length - 9; +for (var i = 0, pt = 0; i < 6; i++, pt += 9) { +this.floats[i] = (pt <= ptLast ? this.parseFloatStr(this.line.substring(pt, pt + 9)) : NaN); +} +}); +Clazz.defineMethod(c$, "readM40FloatLines", +function(nLines, nFloats){ +var data = Clazz.newFloatArray (nLines, nFloats, 0); +for (var i = 0; i < nLines; i++) { +this.readM40Floats(); +if (this.line.indexOf("Legendre") == 19) this.isLegendre = true; +for (var j = 0; j < nFloats; j++) data[i][j] = this.floats[j]; + +} +return data; +}, "~N,~N"); +Clazz.defineMethod(c$, "adjustM40Occupancies", +function(){ +var htSiteMult = new java.util.Hashtable(); +var atoms = this.asc.atoms; +var symmetry = this.asc.getSymmetry(); +for (var i = this.asc.ac; --i >= 0; ) { +var a = atoms[i]; +var ii = htSiteMult.get(a.atomName); +if (ii == null) htSiteMult.put(a.atomName, ii = Integer.$valueOf(symmetry.getSiteMultiplicity(a))); +a.foccupancy *= ii.intValue(); +} +}); +Clazz.defineMethod(c$, "copyModulations", +function(label, newLabel){ +var mapTemp = new java.util.Hashtable(); +for (var e, $e = this.ms.getModulationMap().entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) { +var key = e.getKey(); +if (!key.contains(label)) continue; +key = JU.PT.rep(key, label, newLabel); +var val = e.getValue(); +switch ((key.charAt(0)).charCodeAt(0)) { +case 79: +this.setRigidBodyPhase(key, val = Clazz.newDoubleArray(-1, [val[0], val[1], 0])); +break; +case 68: +break; +case 85: +continue; +} +mapTemp.put(key, val); +} +for (var e, $e = mapTemp.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) this.ms.addModulation(null, e.getKey(), e.getValue(), -1); + +}, "~S,~S"); +Clazz.defineMethod(c$, "setRigidBodyPhase", +function(key, v){ +var isCenter = false; +switch ((this.ms.getModType(key)).charCodeAt(0)) { +case 111: +case 102: +case 117: +break; +case 99: +case 115: +isCenter = true; +break; +} +var nqDotD = 0; +var n = -1; +var qcoefs = this.ms.getQCoefs(key); +for (var i = this.modDim; --i >= 0; ) { +if (qcoefs[i] != 0) { +n = qcoefs[i]; +var q = this.ms.getMod("W_" + (i + 1)); +nqDotD = n * (q[0] * this.vR.x + q[1] * this.vR.y + q[2] * this.vR.z); +break; +}} +if (isCenter) { +v[0] += nqDotD; +} else { +var sA = v[0]; +var cA = v[1]; +var sX = Math.sin(2 * 3.141592653589793 * nqDotD); +var cX = Math.cos(2 * 3.141592653589793 * nqDotD); +v[0] = sA * cX + cA * sX; +v[1] = -sA * sX + cA * cX; +}return v; +}, "~S,~A"); +Clazz.defineMethod(c$, "setRigidBodyRotations", +function(label, params){ +var n = params.length; +for (var i = 0; i < n; i++) { +this.ensureFourier(i); +var key = "D_" + (i + 1); +var data = params[i]; +var vsin = JU.V3.new3(data[0], data[1], data[2]); +var vcos = JU.V3.new3(data[3], data[4], data[5]); +this.cartesianProduct(vcos, this.v0Cart); +this.cartesianProduct(vsin, this.v0Cart); +var keyx = key + "#x" + label; +var keyy = key + "#y" + label; +var keyz = key + "#z" + label; +var vx = this.combineModulation(keyx, vsin.x, vcos.x); +var vy = this.combineModulation(keyy, vsin.y, vcos.y); +var vz = this.combineModulation(keyz, vsin.z, vcos.z); +vsin.set(vx[0], vy[0], vz[0]); +vcos.set(vx[1], vy[1], vz[1]); +this.cartesianProduct(vsin, null); +this.cartesianProduct(vcos, null); +this.setMolecularModulation(keyx, vsin.x, vcos.x); +this.setMolecularModulation(keyy, vsin.y, vcos.y); +this.setMolecularModulation(keyz, vsin.z, vcos.z); +} +}, "~S,~A"); +Clazz.defineMethod(c$, "combineModulation", +function(key, csin, ccos){ +var v = this.ms.getMod(key); +return Clazz.newDoubleArray(-1, [v[0] + csin, v[1] + ccos, 0]); +}, "~S,~N,~N"); +Clazz.defineMethod(c$, "setMolecularModulation", +function(key, csin, ccos){ +this.ms.addModulation(null, key, this.setRigidBodyPhase(key, Clazz.newDoubleArray(-1, [csin, ccos, 0])), -1); +}, "~S,~N,~N"); +c$.XYZ = Clazz.newArray(-1, ["x", "y", "z"]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/MagresReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/MagresReader.js new file mode 100755 index 000000000000..ad44ea811a89 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/MagresReader.js @@ -0,0 +1,178 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader", "java.util.Hashtable", "JU.Lst", "$.SB"], "J.adapter.readers.xtal.MagresReader", ["JU.PT", "J.adapter.smarter.Atom", "JU.Escape", "$.Logger", "$.Tensor"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.currentBlock = -1; +this.cellParams = null; +this.magresUnits = null; +this.interactionTensors = null; +this.header = null; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "MagresReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.prepareFields (c$, function(){ +this.magresUnits = new java.util.Hashtable(); +this.interactionTensors = new JU.Lst(); +this.header = new JU.SB(); +}); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.setFractionalCoordinates(false); +this.ignoreFileSpaceGroupName = true; +}); +Clazz.overrideMethod(c$, "finalizeSubclassReader", +function(){ +this.asc.setInfo("fileHeader", this.header.toString()); +this.finalizeReaderASCR(); +if (this.interactionTensors.size() > 0) this.asc.setCurrentModelInfo("interactionTensors", this.interactionTensors); +}); +Clazz.overrideMethod(c$, "checkLine", +function(){ +if (!this.trimLine()) return true; +switch (this.checkBlock()) { +case 0: +this.header.append(this.line).append("\n"); +this.appendLoadNote(this.line); +break; +case 1: +if (this.cellParams == null && this.line.startsWith("lattice")) return this.readCellParams(); +if (this.line.startsWith("symmetry")) return this.readSymmetry(); +if (this.line.startsWith("units")) return this.setUnits(false); +if (this.line.startsWith("atom")) return this.readAtom(); +break; +case 2: +if (this.line.startsWith("units")) return this.setUnits(true); +return this.readTensor(); +} +return true; +}); +Clazz.defineMethod(c$, "trimLine", +function(){ +var pt = this.line.indexOf("#"); +if (pt >= 0) this.line = this.line.substring(0, pt); +this.line = this.line.trim(); +return (this.line.length > 0); +}); +Clazz.defineMethod(c$, "checkBlock", +function(){ +if (!(this.line.startsWith("<") && this.line.endsWith(">")) && !(this.line.startsWith("[") && this.line.endsWith("]"))) return this.currentBlock; +this.line = JU.PT.rep(this.line, "<", "["); +this.line = JU.PT.rep(this.line, ">", "]"); +switch (Clazz.doubleToInt(("...............[calculation]..[/calculation].[atoms]........[/atoms].......[magres].......[/magres]......").indexOf(this.line + ".") / 15)) { +case 0: +JU.Logger.info("block indicator ignored: " + this.line); +break; +case 1: +if (this.currentBlock == -1) this.currentBlock = 0; +break; +case 2: +if (this.currentBlock == 0) this.currentBlock = -1; +break; +case 3: +if (this.currentBlock == -1) { +this.currentBlock = 1; +this.asc.newAtomSet(); +this.magresUnits = new java.util.Hashtable(); +}break; +case 4: +if (this.currentBlock == 1) this.currentBlock = -1; +break; +case 5: +if (this.currentBlock == -1) { +this.currentBlock = 2; +this.magresUnits = new java.util.Hashtable(); +this.asc.setCurrentModelInfo("magresUnits", this.magresUnits); +}break; +case 6: +if (this.currentBlock == 2) this.currentBlock = -1; +break; +} +return -2; +}); +Clazz.defineMethod(c$, "setUnits", +function(isMagresBlock){ +var tokens = this.getTokens(); +var id = tokens[1]; +if (isMagresBlock) this.appendLoadNote("Ellipsoid set " + JU.PT.esc(id) + ": " + (id.startsWith("ms") ? "Magnetic Shielding" : id.startsWith("efg") ? "Electric Field Gradient" : id.startsWith("isc") ? "J-Coupling" : "?")); +this.magresUnits.put(id, tokens[2]); +return true; +}, "~B"); +Clazz.defineMethod(c$, "readSymmetry", +function(){ +this.setSymmetryOperator(this.getTokens()[1]); +return true; +}); +Clazz.defineMethod(c$, "readCellParams", +function(){ +var tokens = this.getTokens(); +this.cellParams = Clazz.newFloatArray (9, 0); +for (var i = 0; i < 9; i++) this.cellParams[i] = this.parseFloatStr(tokens[i + 1]); + +this.addExplicitLatticeVector(0, this.cellParams, 0); +this.addExplicitLatticeVector(1, this.cellParams, 3); +this.addExplicitLatticeVector(2, this.cellParams, 6); +this.setSpaceGroupName("P1"); +return true; +}); +Clazz.defineMethod(c$, "readAtom", +function(){ +var units = this.magresUnits.get("atom"); +if (units == null) return true; +var f = (units.startsWith("A") ? 1 : 0.5291772); +var tokens = this.getTokens(); +var atom = new J.adapter.smarter.Atom(); +var pt = 1; +atom.elementSymbol = tokens[pt++]; +atom.atomName = J.adapter.readers.xtal.MagresReader.getAtomName(tokens[pt++], tokens[pt++]); +this.asc.addAtomWithMappedName(atom); +var x = this.parseFloatStr(tokens[pt++]) * f; +var y = this.parseFloatStr(tokens[pt++]) * f; +var z = this.parseFloatStr(tokens[pt++]) * f; +atom.set(x, y, z); +this.setAtomCoord(atom); +return true; +}); +c$.getAtomName = Clazz.defineMethod(c$, "getAtomName", +function(name, index){ +return name + "_" + index; +}, "~S,~S"); +Clazz.defineMethod(c$, "readTensor", +function(){ +var tokens = this.getTokens(); +var type = tokens[0]; +var units = this.magresUnits.get(type); +if (units == null) { +JU.Logger.warn(type + " ignored; no units defined; line: " + this.line); +return true; +}var isIsc = type.startsWith("isc"); +if (tokens.length == 10) { +this.magresUnits.remove(type); +var data = Clazz.newFloatArray (9, 0); +for (var i = 0; i < 9; ) data[i] = this.parseFloatStr(tokens[++i]); + +JU.Logger.info("Magres reader creating magres_" + type + ": " + JU.Escape.eAF(data)); +this.asc.setCurrentModelInfo("magres_" + type, data); +}var atomName1 = J.adapter.readers.xtal.MagresReader.getAtomName(tokens[1], tokens[2]); +var pt = 3; +var atomName2 = (isIsc ? J.adapter.readers.xtal.MagresReader.getAtomName(tokens[pt++], tokens[pt++]) : null); +if (atomName1.equals(atomName2)) { +JU.Logger.warn(type + " ignored; atom1 == atom2 for " + atomName1 + " line: " + this.line); +return true; +}var id = atomName1; +if (atomName2 != null) id += "//" + atomName2; +var a = Clazz.newDoubleArray (3, 3, 0); +for (var i = 0; i < 3; i++) for (var j = 0; j < 3; j++) a[i][j] = Double.$valueOf(tokens[pt++]).doubleValue(); + + +var a1 = this.asc.getAtomFromName(atomName1); +if (a1 == null) return true; +var a2 = null; +var t = new JU.Tensor().setFromAsymmetricTensor(a, type, id); +if (atomName2 == null) { +a1.addTensor(t, null, false); +} else { +a2 = this.asc.getAtomFromName(atomName2); +if (a2 == null) return true; +this.interactionTensors.addLast(t); +}t.setAtomIndexes(a1.index, (a2 == null ? -1 : a2.index)); +return true; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/OptimadeReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/OptimadeReader.js new file mode 100755 index 000000000000..ba32584c7d70 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/OptimadeReader.js @@ -0,0 +1,181 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.xtal.OptimadeReader", ["java.util.HashMap", "JU.SB", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.modelNo = 0; +this.iHaveDesiredModel = false; +this.permutation = 0; +this.isPolymer = false; +this.isSlab = false; +this.noSlab = false; +this.xyz = null; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "OptimadeReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.prepareFields (c$, function(){ +this.xyz = Clazz.newFloatArray (3, 0); +}); +Clazz.defineMethod(c$, "initializeReader", +function(){ +Clazz.superCall(this, J.adapter.readers.xtal.OptimadeReader, "initializeReader", []); +this.noSlab = this.checkFilterKey("NOSLAB"); +try { +var strJSON = this.htParams.get("fileData"); +if (strJSON == null) { +var sb = new JU.SB(); +while (this.rd() != null) sb.append(this.line); + +strJSON = sb.toString(); +this.line = null; +}var aData = null; +if (strJSON.startsWith("[")) { +var data = this.vwr.parseJSONArray(strJSON); +for (var i = 0; i < data.size(); i++) { +if (Clazz.instanceOf(data.get(i),"java.util.Map")) { +aData = (data.get(i)).get("data"); +if (aData != null) { +break; +}}} +} else { +aData = this.vwr.parseJSONMap(strJSON).get("data"); +}if (aData != null) { +for (var i = 0; !this.iHaveDesiredModel && i < aData.size(); i++) { +var data = aData.get(i); +if ("structures".equals(data.get("type"))) { +this.readModel(data.get("attributes")); +}} +}} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +e.printStackTrace(); +} else { +throw e; +} +} +this.continuing = false; +}); +Clazz.defineMethod(c$, "readModel", +function(map){ +if (!this.doGetModel(this.modelNumber = ++this.modelNo, null)) return; +this.iHaveDesiredModel = this.isLastModel(this.modelNumber); +this.applySymmetryAndSetTrajectory(); +this.asc.newAtomSet(); +this.setFractionalCoordinates(false); +var dimensionType = Clazz.newFloatArray (3, 0); +if (J.adapter.readers.xtal.OptimadeReader.toFloatArray(map.get("dimension_types"), dimensionType)) { +this.checkDimensionType(dimensionType); +}if (!this.isMolecular) { +this.setSpaceGroupName("P1"); +this.asc.setInfo("symmetryType", (this.isSlab ? "2D - SLAB" : this.isPolymer ? "1D - POLYMER" : "3D")); +}this.asc.setAtomSetName(map.get("chemical_formula_descriptive")); +this.doConvertToFractional = (!this.isMolecular && this.readLattice(map.get("lattice_vectors"))); +this.readAtoms(map.get("species"), map.get("species_at_sites"), map.get("cartesian_site_positions")); +}, "java.util.Map"); +Clazz.defineMethod(c$, "checkDimensionType", +function(dt){ +this.isPolymer = this.isSlab = this.isMolecular = false; +if (this.noSlab) return; +this.permutation = 0; +switch (Clazz.floatToInt(dt[2] + dt[1] * 2 + dt[0] * 4)) { +default: +case 0: +this.isMolecular = true; +break; +case 1: +this.isPolymer = true; +this.permutation = 1; +break; +case 2: +this.isPolymer = true; +this.permutation = 2; +break; +case 3: +this.isSlab = true; +this.permutation = 2; +break; +case 5: +this.isSlab = true; +this.permutation = 1; +break; +case 4: +this.isPolymer = true; +break; +case 6: +this.isSlab = true; +break; +case 7: +break; +} +}, "~A"); +Clazz.defineMethod(c$, "readLattice", +function(lattice){ +if (lattice == null) return false; +var abc = Clazz.newFloatArray (3, 0); +for (var i = 0; i < 3; i++) { +if (!J.adapter.readers.xtal.OptimadeReader.toFloatArray(lattice.get(i), this.xyz)) { +return false; +}this.unitCellParams[0] = NaN; +if (this.isSlab || this.isPolymer) { +abc[i] = Math.sqrt(this.xyz[0] * this.xyz[0] + this.xyz[1] * this.xyz[1] + this.xyz[2] * this.xyz[2]); +if (abc[i] >= 500) { +this.xyz[0] /= abc[i]; +this.xyz[1] /= abc[i]; +this.xyz[2] /= abc[i]; +}}if (this.isSlab || this.isPolymer) this.unitCellParams[0] = 0; +if (i == 2) { +if (this.isSlab || this.isPolymer) { +this.unitCellParams[0] = abc[this.permutation]; +if (this.isSlab) this.unitCellParams[1] = abc[(this.permutation + 1) % 3]; +}}this.addExplicitLatticeVector((i + this.permutation) % 3, this.xyz, 0); +} +this.doApplySymmetry = true; +return true; +}, "java.util.List"); +Clazz.defineMethod(c$, "readAtoms", +function(species, sites, coords){ +var natoms = sites.size(); +var speciesByName = null; +if (species == null) { +JU.Logger.error("OptimadeReader - no 'species' key"); +} else { +speciesByName = new java.util.HashMap(); +for (var i = species.size(); --i >= 0; ) { +var s = species.get(i); +speciesByName.put(s.get("name"), s); +} +}for (var i = 0; i < natoms; i++) { +var sname = sites.get(i); +J.adapter.readers.xtal.OptimadeReader.toFloatArray(coords.get(i), this.xyz); +if (species == null) { +this.addAtom(this.xyz, sites.get(i), sname); +} else { +var sp = speciesByName.get(sname); +var syms = sp.get("chemical_symbols"); +var nOcc = syms.size(); +if (nOcc > 1) { +var conc = Clazz.newFloatArray (nOcc, 0); +if (J.adapter.readers.xtal.OptimadeReader.toFloatArray(sp.get("concentration"), conc)) { +for (var j = 0; j < conc.length; j++) { +var a = this.addAtom(this.xyz, syms.get(j), sname); +a.foccupancy = conc[j]; +} +continue; +}}this.addAtom(this.xyz, syms.get(0), sname); +}} +}, "java.util.List,java.util.List,java.util.List"); +Clazz.defineMethod(c$, "addAtom", +function(xyz, sym, name){ +var atom = this.asc.addNewAtom(); +if (sym != null) atom.elementSymbol = sym; +if (name != null) atom.atomName = name; +this.setAtomCoordXYZ(atom, xyz[0], xyz[1], xyz[2]); +return atom; +}, "~A,~S,~S"); +c$.toFloatArray = Clazz.defineMethod(c$, "toFloatArray", +function(list, a){ +if (list == null) return false; +for (var i = a.length; --i >= 0; ) { +var d = list.get(i); +if (d == null) return false; +a[i] = list.get(i).floatValue(); +} +return true; +}, "java.util.List,~A"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/PWmatReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/PWmatReader.js new file mode 100755 index 000000000000..04924dc04704 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/PWmatReader.js @@ -0,0 +1,214 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.xtal.PWmatReader", ["java.util.Hashtable", "JU.Lst", "$.PT", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.nAtoms = 0; +this.haveLattice = false; +this.havePositions = false; +this.haveMagnetic = false; +this.global3 = ";STRESS_MASK;STRESS_EXTERNAL;PTENSOR_EXTERNAL;"; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "PWmatReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.adapter.readers.xtal.PWmatReader, []); +}); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.doApplySymmetry = true; +}); +Clazz.overrideMethod(c$, "checkLine", +function(){ +if (this.nAtoms == 0) { +this.readComments(); +this.setSpaceGroupName("P1"); +this.nAtoms = JU.PT.parseInt(this.line); +this.setFractionalCoordinates(true); +return true; +}this.removeComments(); +var lc = this.line.toLowerCase().trim(); +if (lc.length == 0) return true; +if (!this.haveLattice) { +if (lc.startsWith("lattice")) { +this.readUnitCell(); +this.haveLattice = true; +}return true; +}if (!this.havePositions) { +if (lc.startsWith("position")) { +this.readCoordinates(); +this.havePositions = true; +}return true; +}if (!this.readDataBlock(lc)) { +this.continuing = false; +}return true; +}); +Clazz.defineMethod(c$, "readComments", +function(){ +}); +Clazz.defineMethod(c$, "readUnitCell", +function(){ +var unitCellData = Clazz.newFloatArray (3, 0); +this.addExplicitLatticeVector(0, this.fillFloatArray(this.getLine(), 0, unitCellData), 0); +this.addExplicitLatticeVector(1, this.fillFloatArray(this.getLine(), 0, unitCellData), 0); +this.addExplicitLatticeVector(2, this.fillFloatArray(this.getLine(), 0, unitCellData), 0); +}); +Clazz.defineMethod(c$, "readCoordinates", +function(){ +var constraints = new JU.Lst(); +var haveConstraints = true; +var i = 0; +while (i++ < this.nAtoms && this.getLine() != null) { +var tokens = this.getTokens(); +var z = Integer.parseInt(tokens[0]); +this.addAtomXYZSymName(tokens, 1, J.adapter.smarter.AtomSetCollectionReader.getElementSymbol(z), null).elementNumber = z; +haveConstraints = (tokens.length >= 7) && haveConstraints; +if (haveConstraints) constraints.addLast( Clazz.newFloatArray(-1, [Float.parseFloat(tokens[4]), Float.parseFloat(tokens[5]), Float.parseFloat(tokens[6])])); +} +var cx = Clazz.newFloatArray (this.nAtoms, 0); +var cy = Clazz.newFloatArray (this.nAtoms, 0); +var cz = Clazz.newFloatArray (this.nAtoms, 0); +var c = Clazz.newFloatArray(-1, [1, 1, 1]); +for (i = this.nAtoms; --i >= 0; ) { +if (haveConstraints) c = constraints.get(i); +cx[i] = c[0]; +cy[i] = c[1]; +cz[i] = c[2]; +} +this.setVectors("constraints", cx, cy, cz, this.nAtoms); +}); +Clazz.defineMethod(c$, "readDataBlock", +function(name){ +name = this.trimPWPropertyNameTo(name, " ([,"); +this.getLine(); +if (this.line == null) return false; +var tokens = this.getTokens(); +switch (tokens.length) { +case 1: +case 2: +case 3: +this.readItems(name, tokens.length - 1, null); +return true; +case 4: +this.readVectors(name, 1, true); +return true; +default: +JU.Logger.error("PWmatReader block " + name.toUpperCase() + " ignored"); +return false; +} +}, "~S"); +Clazz.defineMethod(c$, "trimPWPropertyNameTo", +function(name, chars){ +for (var i = chars.length; --i >= 0; ) { +var pt = name.indexOf(chars.charAt(i)); +if (pt > 0) name = name.substring(0, pt); +} +return name; +}, "~S,~S"); +Clazz.defineMethod(c$, "readItems", +function(name, offset, values){ +if (name.equalsIgnoreCase("magnetic")) this.haveMagnetic = true; +var isGlobal = JU.PT.isOneOf(name.toUpperCase(), this.global3); +if (isGlobal) { +var lines = new Array(3); +lines[0] = this.line; +lines[1] = this.getLine(); +lines[2] = this.getLine(); +var info = this.asc.getAtomSetAuxiliaryInfo(0); +var data = info.get("globalPWmatData"); +if (data == null) info.put("globalPWmatData", data = new java.util.Hashtable()); +data.put(name, lines); +} else { +name = "pwm_" + name; +if (values == null) { +values = Clazz.newFloatArray (this.nAtoms, 0); +} else { +this.getLine(); +}var n = 0; +for (var i = 0; ; ) { +var tokens = this.getTokens(); +if ((values[i] = Float.parseFloat(tokens[offset])) != 0) n++; +if (++i == this.nAtoms) break; +this.getLine(); +} +this.setProperties(name, values, n); +}}, "~S,~N,~A"); +Clazz.defineMethod(c$, "setProperties", +function(name, values, n){ +this.asc.setAtomProperties(name, values, this.asc.iSet, false); +JU.Logger.info("PWmatReader: " + name.toUpperCase() + " processed for " + n + " atoms"); +this.appendLoadNote("PWmatReader read property_" + name); +}, "~S,~A,~N"); +Clazz.defineMethod(c$, "readVectors", +function(name, offset, haveLine){ +if (!haveLine) this.getLine(); +var valuesX = Clazz.newFloatArray (this.nAtoms, 0); +var valuesY = Clazz.newFloatArray (this.nAtoms, 0); +var valuesZ = Clazz.newFloatArray (this.nAtoms, 0); +var n = 0; +for (var i = 0; ; ) { +var tokens = this.getTokens(); +if ((((valuesX[i] = Float.parseFloat(tokens[offset])) == 0 ? 0 : 1) | ((valuesY[i] = Float.parseFloat(tokens[offset + 1])) == 0 ? 0 : 1) | ((valuesZ[i] = Float.parseFloat(tokens[offset + 2])) == 0 ? 0 : 1)) != 0) n++; +if (++i == this.nAtoms) break; +this.getLine(); +} +this.setVectors(name, valuesX, valuesY, valuesZ, n); +}, "~S,~N,~B"); +Clazz.defineMethod(c$, "getLine", +function(){ +this.rd(); +return this.removeComments(); +}); +Clazz.defineMethod(c$, "removeComments", +function(){ +if (this.line != null) { +var pt = this.line.indexOf("#"); +if (pt >= 0) { +this.line = this.line.substring(0, pt).trim(); +}}return this.line; +}); +Clazz.defineMethod(c$, "setVectors", +function(name, valuesX, valuesY, valuesZ, n){ +name = "pwm_" + name; +this.asc.setAtomProperties(name + "_x", valuesX, this.asc.iSet, false); +this.asc.setAtomProperties(name + "_y", valuesY, this.asc.iSet, false); +this.asc.setAtomProperties(name + "_z", valuesZ, this.asc.iSet, false); +JU.Logger.info("PWmatReader: " + name.toUpperCase() + " processed for " + n + " atoms"); +this.appendLoadNote("PWmatReader read property_" + name + "_x"); +this.appendLoadNote("PWmatReader read property_" + name + "_y"); +this.appendLoadNote("PWmatReader read property_" + name + "_z"); +if (name.equals("pwm_magnetic_xyz")) { +for (var i = 0; i < this.nAtoms; i++) { +this.asc.addVibrationVector(i, valuesX[i], valuesY[i], valuesZ[i]); +} +this.addJmolScript("vectors 0.2;set vectorscentered"); +}}, "~S,~A,~A,~A,~N"); +Clazz.defineMethod(c$, "applySymmetryAndSetTrajectory", +function(){ +Clazz.superCall(this, J.adapter.readers.xtal.PWmatReader, "applySymmetryAndSetTrajectory", []); +if (this.nAtoms != this.asc.ac) { +this.nAtoms = this.asc.ac; +var p = this.asc.getAtomSetAuxiliaryInfoValue(this.asc.iSet, "atomProperties"); +if (p != null) { +var atoms = this.asc.atoms; +var n = (this.asc.bsAtoms == null ? this.nAtoms : this.asc.bsAtoms.cardinality()); +var map = (n == this.nAtoms ? null : Clazz.newIntArray (this.nAtoms, 0)); +if (map != null) { +for (var j = 0, k = 0; j < this.nAtoms; j++) { +if (this.asc.bsAtoms.get(j)) map[j] = k++; +} +}for (var e, $e = p.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) { +var key = e.getKey(); +if (key.startsWith("pwm_")) { +var af = e.getValue(); +var af2 = Clazz.newFloatArray (n, 0); +for (var j = 0; j < this.nAtoms; j++) { +af2[map == null ? j : map[j]] = af[atoms[j].atomSite]; +} +e.setValue(af2); +}} +}}}); +Clazz.overrideMethod(c$, "finalizeSubclassReader", +function(){ +if (!this.haveMagnetic && this.asc.ac > 0) { +this.setProperties("pwm_magnetic", Clazz.newFloatArray (this.asc.ac, 0), this.nAtoms); +}}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/ShelxReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/ShelxReader.js new file mode 100755 index 000000000000..509eead87b4d --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/ShelxReader.js @@ -0,0 +1,226 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.xtal.ShelxReader", ["JU.AU", "$.PT", "J.adapter.smarter.Atom", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.sfacElementSymbols = null; +this.isCmdf = false; +this.tokens = null; +this.altloc = '\0'; +this.isCentroSymmetric = false; +this.haveXYZ = false; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "ShelxReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.setFractionalCoordinates(true); +}); +Clazz.overrideMethod(c$, "checkLine", +function(){ +var lineLength; +while ((lineLength = (this.line = this.line.trim()).length) > 0 && this.line.charAt(lineLength - 1) == '=') this.line = this.line.substring(0, lineLength - 1) + this.rd(); + +this.tokens = this.getTokens(); +if (this.tokens.length == 0) return true; +var command = this.tokens[0].toUpperCase(); +if (command.equals("TITL")) { +if (!this.doGetModel(++this.modelNumber, null)) return this.checkLastModel(); +this.sfacElementSymbols = null; +this.applySymmetryAndSetTrajectory(); +this.setFractionalCoordinates(true); +this.asc.newAtomSet(); +this.asc.setAtomSetName(this.line.substring(4).trim()); +return true; +}if (command.equals("NOTE")) { +this.isCmdf = true; +return true; +}if (!this.doProcessLines || lineLength < 3) return true; +if (";ZERR;DISP;UNIT;LAUE;REM;MORE;TIME;HKLF;OMIT;SHEL;BASF;TWIN;EXTI;SWAT;HOPE;MERG;SPEC;RESI;MOVE;ANIS;AFIX;HFIX;FRAG;FEND;EXYZ;EXTI;EADP;EQIV;CONN;BIND;FREE;DFIX;DANG;BUMP;SAME;SADI;CHIV;FLAT;DELU;SIMU;DEFS;ISOR;NCSY;SUMP;L.S.;CGLS;BLOC;DAMP;STIR;WGHT;FVAR;BOND;CONF;MPLA;RTAB;HTAB;LIST;ACTA;SIZE;TEMP;WPDB;FMAP;GRID;PLAN;MOLE;".indexOf(";" + command + ";") >= 0) return true; +for (var i = J.adapter.readers.xtal.ShelxReader.supportedRecordTypes.length; --i >= 0; ) if (command.equals(J.adapter.readers.xtal.ShelxReader.supportedRecordTypes[i])) { +this.processSupportedRecord(i); +return true; +} +if (!this.isCmdf) this.assumeAtomRecord(); +return true; +}); +Clazz.defineMethod(c$, "processSupportedRecord", +function(recordIndex){ +switch (recordIndex) { +case 0: +case 9: +break; +case 1: +this.cell(); +break; +case 2: +this.setSpaceGroupName(JU.PT.parseTrimmedAt(this.line, 4)); +break; +case 3: +this.parseSfacRecord(); +break; +case 4: +this.parseLattRecord(); +break; +case 5: +this.parseSymmRecord(); +break; +case 6: +this.isCmdf = true; +break; +case 7: +this.isCmdf = true; +this.processCmdfAtoms(); +break; +case 8: +this.processPartRecord(); +break; +} +}, "~N"); +Clazz.defineMethod(c$, "processPartRecord", +function(){ +var part = this.parseIntStr(this.tokens[1]); +this.altloc = String.fromCharCode(part == 0 ? 0 : 48 + part); +}); +Clazz.defineMethod(c$, "parseLattRecord", +function(){ +var latt = this.parseIntStr(this.tokens[1]); +this.isCentroSymmetric = (latt > 0); +if (latt == 1 || latt == -1) return; +this.asc.getXSymmetry().setLatticeParameter(latt); +}); +Clazz.defineMethod(c$, "parseSymmRecord", +function(){ +if (!this.haveXYZ) { +this.setSymmetryOperator("x,y,z"); +this.haveXYZ = true; +}this.setSymmetryOperator(this.line.substring(4).trim()); +}); +Clazz.defineMethod(c$, "cell", +function(){ +var ioff = this.tokens.length - 6; +if (ioff == 2) this.asc.setInfo("wavelength", Float.$valueOf(this.parseFloatStr(this.tokens[1]))); +for (var ipt = 0; ipt < 6; ipt++) this.setUnitCellItem(ipt, this.parseFloatStr(this.tokens[ipt + ioff])); + +}); +Clazz.defineMethod(c$, "parseSfacRecord", +function(){ +var allElementSymbols = true; +for (var i = this.tokens.length; allElementSymbols && --i >= 1; ) { +var token = this.tokens[i]; +allElementSymbols = J.adapter.readers.xtal.ShelxReader.isValidElementSymbolNoCaseSecondChar(token); +} +var sfacTokens = JU.PT.getTokens(this.line.substring(4)); +if (allElementSymbols) this.parseSfacElementSymbols(sfacTokens); + else this.parseSfacCoefficients(sfacTokens); +}); +Clazz.defineMethod(c$, "parseSfacElementSymbols", +function(sfacTokens){ +if (this.sfacElementSymbols == null) { +this.sfacElementSymbols = sfacTokens; +} else { +var oldCount = this.sfacElementSymbols.length; +var tokenCount = sfacTokens.length; +this.sfacElementSymbols = JU.AU.arrayCopyS(this.sfacElementSymbols, oldCount + tokenCount); +for (var i = tokenCount; --i >= 0; ) this.sfacElementSymbols[oldCount + i] = sfacTokens[i]; + +}}, "~A"); +Clazz.defineMethod(c$, "parseSfacCoefficients", +function(sfacTokens){ +var a1 = this.parseFloatStr(sfacTokens[1]); +var a2 = this.parseFloatStr(sfacTokens[3]); +var a3 = this.parseFloatStr(sfacTokens[5]); +var a4 = this.parseFloatStr(sfacTokens[7]); +var c = this.parseFloatStr(sfacTokens[9]); +var z = Math.round(a1 + a2 + a3 + a4 + c); +var elementSymbol = J.adapter.smarter.AtomSetCollectionReader.getElementSymbol(z); +var oldCount = 0; +if (this.sfacElementSymbols == null) { +this.sfacElementSymbols = new Array(1); +} else { +oldCount = this.sfacElementSymbols.length; +this.sfacElementSymbols = JU.AU.arrayCopyS(this.sfacElementSymbols, oldCount + 1); +this.sfacElementSymbols[oldCount] = elementSymbol; +}this.sfacElementSymbols[oldCount] = elementSymbol; +}, "~A"); +Clazz.defineMethod(c$, "assumeAtomRecord", +function(){ +var x = NaN; +var y = NaN; +var z = NaN; +var occ = 1; +var elementIndex = -1; +var atomName = null; +try { +atomName = this.tokens[0]; +elementIndex = this.parseIntStr(this.tokens[1]) - 1; +x = this.parseFloatStr(this.tokens[2]) % 10; +y = this.parseFloatStr(this.tokens[3]) % 10; +z = this.parseFloatStr(this.tokens[4]) % 10; +occ = this.parseFloatStr(this.tokens[5]) % 10; +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +if (Float.isNaN(x) || Float.isNaN(y) || Float.isNaN(z)) { +JU.Logger.error("skipping line " + this.line); +return; +}var atom = this.asc.addNewAtom(); +atom.atomName = atomName; +atom.foccupancy = occ; +var isQPeak = atomName.startsWith("Q"); +if (isQPeak) { +atom.elementSymbol = "Xx"; +} else if (this.sfacElementSymbols != null && elementIndex >= 0 && elementIndex < this.sfacElementSymbols.length) { +atom.elementSymbol = this.sfacElementSymbols[elementIndex]; +}this.setAtomCoordXYZ(atom, x, y, z); +atom.altLoc = this.altloc; +if (this.tokens.length == 12) { +var data = Clazz.newFloatArray (8, 0); +data[0] = this.parseFloatStr(this.tokens[6]); +data[1] = this.parseFloatStr(this.tokens[7]); +data[2] = this.parseFloatStr(this.tokens[8]); +data[3] = this.parseFloatStr(this.tokens[11]); +data[4] = this.parseFloatStr(this.tokens[10]); +data[5] = this.parseFloatStr(this.tokens[9]); +for (var i = 0; i < 6; i++) if (Float.isNaN(data[i])) { +JU.Logger.error("Bad anisotropic Uij data: " + this.line); +return; +} +this.asc.setAnisoBorU(atom, data, 8); +}}); +Clazz.defineMethod(c$, "processCmdfAtoms", +function(){ +while (this.rd() != null && this.line.length > 10) { +this.tokens = this.getTokens(); +this.addAtomXYZSymName(this.tokens, 2, this.getSymbol(this.tokens[0]), this.tokens[1]); +} +}); +Clazz.defineMethod(c$, "getSymbol", +function(sym){ +if (sym == null) return "Xx"; +var len = sym.length; +if (len < 2) return sym; +var ch1 = sym.charAt(1); +if (ch1 >= 'a' && ch1 <= 'z') return sym.substring(0, 2); +return "" + sym.charAt(0); +}, "~S"); +c$.isValidElementSymbolNoCaseSecondChar = Clazz.defineMethod(c$, "isValidElementSymbolNoCaseSecondChar", +function(str){ +if (str == null) return false; +var length = str.length; +if (length == 0) return false; +var chFirst = str.charAt(0); +if (length == 1) return J.adapter.smarter.Atom.isValidSym1(chFirst); +if (length > 2) return false; +var chSecond = str.charAt(1); +return J.adapter.smarter.Atom.isValidSymNoCase(chFirst, chSecond); +}, "~S"); +Clazz.overrideMethod(c$, "applySymmetryAndSetTrajectory", +function(){ +if (this.isCentroSymmetric && !this.ignoreFileSymmetryOperators) { +this.asc.getXSymmetry().getSymmetry().addInversion(); +this.isCentroSymmetric = false; +}this.applySymTrajASCR(); +}); +c$.supportedRecordTypes = Clazz.newArray(-1, ["TITL", "CELL", "SPGR", "SFAC", "LATT", "SYMM", "NOTE", "ATOM", "PART", "END"]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/SiestaReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/SiestaReader.js new file mode 100755 index 000000000000..d8a14229508c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/SiestaReader.js @@ -0,0 +1,206 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.xtal.SiestaReader", ["java.util.Hashtable", "JU.PT"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.noAtoms = 0; +this.acfUnits = "bohr"; +this.tokens = null; +this.STATE_UNKNOWN = 0; +this.STATE_INPUT = 1; +this.STATE_OUTPUT = 2; +this.state = 0; +this.acfFactor = 0; +this.htSpecies = null; +this.unitCellVectors = null; +this.unitCellParamsS = null; +this.latticeConstant = 1; +this.latticeUnits = null; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "SiestaReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.doApplySymmetry = true; +}); +Clazz.overrideMethod(c$, "checkLine", +function(){ +if (this.line.length == 0 || this.line.charAt(0) == '#' || this.line.indexOf(' ') < 0 && this.line.indexOf('\t') < 0) return true; +switch (this.state) { +case 0: +if (this.line.indexOf("Dump of input data file") >= 0) { +this.state = 1; +return true; +}this.tokens = this.getTokens(); +if (this.fixToken(0).equals("numberofspecies")) { +this.state = 1; +return false; +}return true; +case 1: +if (this.line.indexOf("End of input data file") >= 0) { +this.state = 2; +return true; +}this.tokens = this.getTokens(); +if (this.tokens[0].equals("%block")) { +this.readBlock(this.fixToken(1)); +} else { +this.readValue(this.fixToken(0)); +}return true; +} +if (this.line.contains("outcoor: Atomic coordinates")) { +if (this.doGetModel(++this.modelNumber, null)) this.readAtomsCartGeomThenCell(); +return true; +}return true; +}); +Clazz.defineMethod(c$, "readValue", +function(key){ +if (key.equals("latticeconstant")) { +this.setCell("latticeconstant"); +} else if (key.equals("atomiccoordinatesformat")) { +this.readAtomicCoordinatesFormat(); +}}, "~S"); +Clazz.defineMethod(c$, "readBlock", +function(key){ +if (key.equals("latticevectors") || key.equals("latticeparameters")) return this.setCell(key); +if (key.equals("chemicalspecieslabel")) return this.readSpecies(); +if (key.equals("atomiccoordinatesandatomicspecies")) { +if (!this.doGetModel(++this.modelNumber, null)) { +this.skipModel(); +return false; +}return this.readAtoms(); +}this.discardLinesUntilContains("%endblock"); +return true; +}, "~S"); +Clazz.defineMethod(c$, "readSpecies", +function(){ +this.htSpecies = new java.util.Hashtable(); +while (this.rdSiesta().indexOf("%") < 0) { +this.tokens = this.getTokens(); +this.htSpecies.put(this.tokens[0], this.tokens); +} +return false; +}); +Clazz.defineMethod(c$, "fixToken", +function(i){ +return JU.PT.replaceAllCharacters(this.tokens[i], "_.-", "").toLowerCase(); +}, "~N"); +Clazz.defineMethod(c$, "rdSiesta", +function(){ +var s = this.rd(); +var pt = s.indexOf("#"); +return (pt < 0 ? s : s.substring(pt)).trim(); +}); +Clazz.defineMethod(c$, "getACFValue", +function(v){ +if (this.acfFactor == 0) { +var isScaledCartesian = (this.acfUnits === "scaledcartesian"); +if (isScaledCartesian) this.acfUnits = this.latticeUnits; +this.acfUnits = JU.PT.rep(this.acfUnits, "notscaledcartesian", ""); +switch ((this.acfUnits.charAt(0)).charCodeAt(0)) { +default: +case 98: +this.setFractionalCoordinates(isScaledCartesian); +this.acfFactor = (1.8897268777743552); +break; +case 109: +this.setFractionalCoordinates(isScaledCartesian); +this.acfFactor = (1.0E-10); +break; +case 110: +this.setFractionalCoordinates(isScaledCartesian); +this.acfFactor = (0.1); +break; +case 97: +this.setFractionalCoordinates(isScaledCartesian); +this.acfFactor = 1; +break; +case 102: +case 115: +this.setFractionalCoordinates(true); +this.acfFactor = 1; +break; +} +if (isScaledCartesian) { +this.acfFactor /= this.latticeConstant; +this.setFractionalCoordinates(true); +}}return (this.acfFactor * v); +}, "~N"); +Clazz.defineMethod(c$, "readAtomicCoordinatesFormat", +function(){ +this.acfUnits = this.tokens[1].toLowerCase().intern(); +}); +Clazz.defineMethod(c$, "skipModel", +function(){ +this.discardLinesUntilContains("%endblock AtomicCoordinatesAndAtomicSpecies"); +}); +Clazz.defineMethod(c$, "setCell", +function(key){ +if (key.equals("latticevectors")) { +this.unitCellVectors = Clazz.newFloatArray (9, 0); +this.fillFloatArray(null, 0, this.unitCellVectors); +} else if (key.equals("latticeconstant")) { +var tokens = this.getTokens(); +this.latticeConstant = this.parseFloatStr(tokens[1]); +this.latticeUnits = tokens[2].toLowerCase(); +} else if (key.equals("latticeparameters")) { +this.unitCellParamsS = Clazz.newFloatArray (6, 0); +this.fillFloatArray(this.line.substring(this.line.indexOf("ters") + 4), 0, this.unitCellParamsS); +}return true; +}, "~S"); +Clazz.defineMethod(c$, "readAtoms", +function(){ +this.newAtomSet(); +if (this.unitCellVectors != null) { +this.addExplicitLatticeVector(0, this.unitCellVectors, 0); +this.addExplicitLatticeVector(1, this.unitCellVectors, 3); +this.addExplicitLatticeVector(2, this.unitCellVectors, 6); +} else if (this.unitCellParamsS != null) { +this.setUnitCell(this.unitCellParamsS[0] * this.latticeConstant, this.unitCellParamsS[1] * this.latticeConstant, this.unitCellParamsS[2] * this.latticeConstant, this.unitCellParamsS[3], this.unitCellParamsS[4], this.unitCellParamsS[5]); +}while (this.rdSiesta() != null && this.line.indexOf("%endblock Atomic") < 0) { +var tokens = this.getTokens(); +var species = (this.htSpecies == null ? Clazz.newArray(-1, [null, null, tokens[4]]) : this.htSpecies.get(tokens[3])); +var name = species[2]; +var sym = (species[1] == null ? name : J.adapter.smarter.AtomSetCollectionReader.getElementSymbol(this.parseIntStr(species[1]))); +this.addAtomXYZSymName(tokens, 0, sym, name); +} +this.noAtoms = this.asc.ac; +return true; +}); +Clazz.defineMethod(c$, "setAtomCoordXYZ", +function(atom, x, y, z){ +Clazz.superCall(this, J.adapter.readers.xtal.SiestaReader, "setAtomCoordXYZ", [atom, this.getACFValue(x), this.getACFValue(y), this.getACFValue(z)]); +}, "J.adapter.smarter.Atom,~N,~N,~N"); +Clazz.defineMethod(c$, "newAtomSet", +function(){ +this.applySymmetryAndSetTrajectory(); +this.asc.newAtomSet(); +this.setSpaceGroupName("P1"); +this.setFractionalCoordinates(false); +}); +Clazz.defineMethod(c$, "readAtomsCartGeomThenCell", +function(){ +this.readLines(1); +this.newAtomSet(); +var atom0 = this.asc.ac; +for (var i = 0; i < this.noAtoms; i++) { +var tokens = this.getTokens(); +var atom = this.asc.addNewAtom(); +atom.atomName = tokens[4]; +var x = this.parseFloatStr(tokens[0]); +var y = this.parseFloatStr(tokens[1]); +var z = this.parseFloatStr(tokens[2]); +atom.set(x, y, z); +this.rdSiesta(); +} +this.discardLinesUntilContains("outcell: Unit cell vectors"); +this.setCell("vectors"); +var atoms = this.asc.atoms; +var ac = this.asc.ac; +for (var i = atom0; i < ac; i++) this.setAtomCoord(atoms[i]); + +this.discardLinesUntilContains("siesta: E_KS(eV) = "); +var tokens = this.getTokens(); +var energy = Double.$valueOf(Double.parseDouble(tokens[3])); +this.asc.setAtomSetEnergy("" + energy, energy.floatValue()); +this.asc.setCurrentModelInfo("Energy", energy); +this.asc.setInfo("Energy", energy); +this.asc.setAtomSetName("Energy = " + energy + " eV"); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/VaspChgcarReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/VaspChgcarReader.js new file mode 100755 index 000000000000..0ea0663f05f0 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/VaspChgcarReader.js @@ -0,0 +1,5 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.readers.xtal.VaspPoscarReader"], "J.adapter.readers.xtal.VaspChgcarReader", null, function(){ +var c$ = Clazz.declareType(J.adapter.readers.xtal, "VaspChgcarReader", J.adapter.readers.xtal.VaspPoscarReader); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/VaspOutcarReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/VaspOutcarReader.js new file mode 100755 index 000000000000..a19499a171e4 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/VaspOutcarReader.js @@ -0,0 +1,188 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader", "JU.Lst"], "J.adapter.readers.xtal.VaspOutcarReader", ["JU.DF", "$.PT"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.atomNames = null; +this.ac = 0; +this.inputOnly = false; +this.mDsimulation = false; +this.vaspVersion = 0; +this.elementNames = null; +this.gibbsEnergy = null; +this.gibbsEntropy = null; +this.electronEne = null; +this.kinEne = null; +this.totEne = null; +this.temp = 0; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "VaspOutcarReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.prepareFields (c$, function(){ +this.elementNames = new JU.Lst(); +}); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.isPrimitive = true; +this.setSpaceGroupName("P1"); +this.setFractionalCoordinates(true); +this.inputOnly = this.checkFilterKey("INPUT"); +}); +Clazz.overrideMethod(c$, "checkLine", +function(){ +if (this.vaspVersion == 0 && this.line.contains(" vasp.")) { +this.readVersion(); +if (this.vaspVersion > 0) this.appendLoadNote("VASP version " + this.vaspVersion + " " + this.line); +} else if (this.line.toUpperCase().startsWith(" POTCAR:")) { +this.readElementNames(); +} else if (this.line.contains("ions per type")) { +this.readAtomCountAndSetNames(); +} else if (this.line.contains("molecular dynamics for ions")) { +this.mDsimulation = true; +} else if (this.line.contains("direct lattice vectors")) { +this.readUnitCellVectors(); +} else if (this.ac > 0 && this.line.contains("position of ions in fractional coordinates")) { +this.readInitialCoordinates(); +if (this.inputOnly) this.continuing = false; +} else if (this.line.contains("POSITION")) { +this.readPOSITION(); +return true; +} else if (this.line.startsWith(" FREE ENERGIE") && !this.mDsimulation) { +this.readEnergy(); +} else if (this.line.contains("ENERGIE OF THE ELECTRON-ION-THERMOSTAT") && this.mDsimulation) { +this.readMdyn(); +} else if (this.line.startsWith(" Eigenvectors and eigenvalues of the dynamical matrix")) { +this.readFrequency(); +}return true; +}); +Clazz.defineMethod(c$, "readVersion", +function(){ +var tokens = JU.PT.split(this.line, "."); +this.vaspVersion = JU.PT.parseInt(tokens[1]); +}); +Clazz.overrideMethod(c$, "finalizeSubclassReader", +function(){ +this.setSymmetry(); +}); +Clazz.defineMethod(c$, "readElementNames", +function(){ +this.line = JU.PT.rep(this.line, " _ ", "_"); +var tokens = this.getTokens(); +var pt = tokens[1].indexOf(":"); +var name = (pt >= 0 ? tokens[1].substring(0, pt) : tokens[2]); +this.elementNames.addLast(name); +}); +Clazz.defineMethod(c$, "readAtomCountAndSetNames", +function(){ +var numofElement = Clazz.newIntArray (100, 0); +var tokens = JU.PT.getTokens(this.line.substring(this.line.indexOf("=") + 1)); +this.ac = 0; +for (var i = 0; i < tokens.length; i++) this.ac += (numofElement[i] = this.parseIntStr(tokens[i])); + +this.atomNames = new Array(this.ac); +var nElements = this.elementNames.size(); +for (var pt = 0, i = 0; i < nElements; i++) for (var j = 0; j < numofElement[i] && pt < this.ac; j++) this.atomNames[pt++] = this.elementNames.get(i); + + +}); +Clazz.defineMethod(c$, "readUnitCellVectors", +function(){ +if (this.asc.ac > 0) { +this.setSymmetry(); +this.asc.newAtomSet(); +this.setAtomSetInfo(); +}var f = Clazz.newFloatArray (3, 0); +for (var i = 0; i < 3; i++) this.addExplicitLatticeVector(i, this.fillFloatArray(this.fixMinus(this.rd()), 0, f), 0); + +}); +Clazz.defineMethod(c$, "fixMinus", +function(line){ +return JU.PT.rep(line, "-", " -"); +}, "~S"); +Clazz.defineMethod(c$, "setSymmetry", +function(){ +this.applySymmetryAndSetTrajectory(); +this.setSpaceGroupName("P1"); +this.setFractionalCoordinates(false); +}); +Clazz.defineMethod(c$, "readInitialCoordinates", +function(){ +var counter = 0; +while (this.rd() != null && this.line.length > 10) { +this.addAtomXYZSymName(JU.PT.getTokens(this.fixMinus(this.line)), 0, null, this.atomNames[counter++]); +} +this.asc.setAtomSetName("Initial Coordinates"); +}); +Clazz.defineMethod(c$, "readPOSITION", +function(){ +var counter = 0; +this.readLines(1); +while (this.rd() != null && this.line.indexOf("----------") < 0) this.addAtomXYZSymName(this.getTokens(), 0, null, this.atomNames[counter++]); + +}); +Clazz.defineMethod(c$, "readEnergy", +function(){ +this.rd(); +var tokens = JU.PT.getTokens(this.rd()); +this.gibbsEnergy = Double.$valueOf(Double.parseDouble(tokens[4])); +this.rd(); +tokens = JU.PT.getTokens(this.rd()); +var enthalpy = Double.parseDouble(tokens[3]); +this.gibbsEntropy = Double.$valueOf(enthalpy - this.gibbsEnergy.doubleValue()); +}); +Clazz.defineMethod(c$, "setAtomSetInfo", +function(){ +if (this.gibbsEnergy == null) return; +this.asc.setAtomSetEnergy("" + this.gibbsEnergy, this.gibbsEnergy.floatValue()); +this.asc.setCurrentModelInfo("Energy", this.gibbsEnergy); +this.asc.setCurrentModelInfo("Entropy", this.gibbsEntropy); +this.asc.setInfo("Energy", this.gibbsEnergy); +this.asc.setInfo("Entropy", this.gibbsEntropy); +this.asc.setAtomSetName("G = " + this.gibbsEnergy + " eV, T*S = " + this.gibbsEntropy + " eV"); +}); +Clazz.defineMethod(c$, "readMdyn", +function(){ +var tokens = this.getTokens(); +this.rd(); +tokens = JU.PT.getTokens(this.rd()); +this.electronEne = Double.$valueOf(Double.parseDouble(tokens[4])); +tokens = JU.PT.getTokens(this.rd()); +this.kinEne = Double.$valueOf(Double.parseDouble(tokens[4])); +this.temp = this.parseFloatStr(tokens[6]); +this.readLines(3); +tokens = JU.PT.getTokens(this.rd()); +this.totEne = Double.$valueOf(Double.parseDouble(tokens[4])); +this.setAtomSetInfoMd(); +}); +Clazz.defineMethod(c$, "setAtomSetInfoMd", +function(){ +this.asc.setAtomSetName("Temp. = " + JU.DF.formatDecimal((this.temp), 2) + " K, Energy = " + this.totEne + " eV"); +this.asc.setCurrentModelInfo("Energy", this.totEne); +this.asc.setInfo("Energy", this.totEne); +this.asc.setCurrentModelInfo("EleEnergy", this.kinEne); +this.asc.setInfo("EleEnergy", this.electronEne); +this.asc.setCurrentModelInfo("Kinetic", this.electronEne); +this.asc.setInfo("Kinetic", this.kinEne); +this.asc.setCurrentModelInfo("Temperature", JU.DF.formatDecimal((this.temp), 2)); +this.asc.setInfo("Temperature", JU.DF.formatDecimal((this.temp), 2)); +}); +Clazz.defineMethod(c$, "readFrequency", +function(){ +var pt = this.asc.iSet; +this.asc.baseSymmetryAtomCount = this.ac; +if (this.vaspVersion >= 5) { +this.readLines(3); +} else { +this.discardLinesUntilContains("Eigenvectors after division by SQRT(mass)"); +this.readLines(5); +}var ignore = Clazz.newBooleanArray(1, false); +while (this.rd() != null && (this.line.contains("f = ") || this.line.contains("f/i= "))) { +this.applySymmetryAndSetTrajectory(); +var iAtom0 = this.asc.ac; +this.cloneLastAtomSet(this.ac, null); +if (!ignore[0]) { +this.asc.iSet = ++pt; +this.asc.setAtomSetFrequency(this.vibrationNumber, null, null, this.line.substring(this.line.indexOf("2PiTHz") + 6, this.line.indexOf("c") - 1).trim(), null); +}this.rd(); +this.fillFrequencyData(iAtom0, this.ac, this.ac, ignore, true, 35, 12, null, 0, null); +this.rd(); +} +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/VaspPoscarReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/VaspPoscarReader.js new file mode 100755 index 000000000000..4959c0e2672b --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/VaspPoscarReader.js @@ -0,0 +1,140 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.xtal.VaspPoscarReader", ["JU.Lst", "$.M3", "$.PT", "$.SB", "J.api.JmolAdapter", "JU.Logger", "$.Parser"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.atomLabels = null; +this.haveAtomLabels = true; +this.atomsLabeledInline = false; +this.scaleFac = 0; +this.ac = 0; +this.title = null; +this.quiet = false; +this.defaultLabels = null; +this.unitCellData = null; +this.elementLabel = null; +this.radiusPt = -2147483648; +this.elementPt = -2147483648; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "VaspPoscarReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.isPrimitive = true; +this.readStructure(null); +this.continuing = false; +}); +Clazz.defineMethod(c$, "readStructure", +function(titleMsg){ +this.title = this.rd().trim(); +var pt = this.title.indexOf("--params"); +if ((pt = this.title.indexOf("& ", pt + 1)) >= 0) { +this.latticeType = this.title.substring(pt + 2, pt + 3); +JU.Logger.info("AFLOW lattice:" + this.latticeType + " title=" + this.title); +}this.readUnitCellVectors(); +this.readMolecularFormula(); +this.readCoordinates(); +this.asc.setAtomSetName(this.title + (titleMsg == null ? "" : "[" + titleMsg + "]")); +}, "~S"); +Clazz.overrideMethod(c$, "finalizeSubclassReader", +function(){ +if (!this.iHaveFractionalCoordinates) this.fractionalizeCoordinates(true); +if (!this.haveAtomLabels && !this.atomsLabeledInline) this.appendLoadNote("VASP POSCAR reader using pseudo atoms Al B C Db..."); +this.finalizeReaderASCR(); +}); +Clazz.defineMethod(c$, "readUnitCellVectors", +function(){ +this.setSpaceGroupName("P1"); +this.setFractionalCoordinates(true); +this.scaleFac = this.parseFloatStr(this.rdline().trim()); +var isVolume = (this.scaleFac < 0); +if (isVolume) this.scaleFac = Math.pow(-this.scaleFac, 0.3333333333333333); +this.unitCellData = Clazz.newFloatArray (9, 0); +var s = this.rdline() + " " + this.rdline() + " " + this.rdline(); +JU.Parser.parseStringInfestedFloatArray(s, null, this.unitCellData); +if (isVolume) { +var m = JU.M3.newA9(this.unitCellData); +this.scaleFac /= m.determinant3(); +}if (this.scaleFac != 1) for (var i = 0; i < this.unitCellData.length; i++) this.unitCellData[i] *= this.scaleFac; + +}); +Clazz.defineMethod(c$, "readMolecularFormula", +function(){ +if (this.elementLabel == null) this.elementLabel = JU.PT.getTokens(this.discardLinesUntilNonBlank()); +var elementCounts; +if (JU.PT.parseInt(this.elementLabel[0]) == -2147483648) { +this.atomsLabeledInline = false; +elementCounts = JU.PT.getTokens(this.rdline()); +while (this.line != null && (elementCounts.length == 0 || this.parseIntStr(elementCounts[0]) == -2147483648)) elementCounts = JU.PT.getTokens(this.rdline()); + +} else { +elementCounts = this.elementLabel; +this.elementLabel = JU.PT.split(this.title, " "); +if (this.elementLabel.length != elementCounts.length || this.elementLabel[0].length > 2) { +this.elementLabel = JU.PT.split("Al B C Db Eu F Ga Hf I K Li Mn N O P Ru S Te U V W Xe Yb Zn", " "); +this.haveAtomLabels = false; +}}var labels = this.elementLabel; +var mf = new JU.SB(); +this.atomLabels = new JU.Lst(); +this.ac = 0; +for (var i = 0; i < elementCounts.length; i++) { +var n = Integer.parseInt(elementCounts[i]); +this.ac += n; +var label = labels[i]; +mf.append(" ").append(label).appendI(n); +for (var j = n; --j >= 0; ) this.atomLabels.addLast(label); + +} +var s = mf.toString(); +if (!this.quiet) this.appendLoadNote(this.ac + " atoms identified for" + s); +this.asc.newAtomSet(); +this.asc.setAtomSetName(s); +}); +Clazz.defineMethod(c$, "readCoordinates", +function(){ +var isSelective = this.discardLinesUntilNonBlank().toLowerCase().contains("selective"); +if (isSelective) this.rd(); +var isCartesian = (this.line.toLowerCase().contains("cartesian")); +if (isCartesian) { +this.setFractionalCoordinates(false); +}this.addExplicitLatticeVector(0, this.unitCellData, 0); +this.addExplicitLatticeVector(1, this.unitCellData, 3); +this.addExplicitLatticeVector(2, this.unitCellData, 6); +for (var i = 0; i < this.ac; i++) { +var radius = NaN; +var tokens = JU.PT.getTokens(this.rdline()); +if (this.radiusPt == -2147483648) { +for (var j = tokens.length; --j > 2; ) { +var t = tokens[j]; +if (t.equals("radius")) { +this.radiusPt = j + 1; +} else if (!t.equals("T") && !t.equals("F") && this.getElement(t) != null) { +this.elementPt = j; +this.atomsLabeledInline = true; +}} +}if (this.radiusPt >= 0) radius = this.parseFloatStr(tokens[this.radiusPt]); +var label = (this.atomsLabeledInline ? tokens[this.elementPt] : this.atomLabels.get(i)); +if (isCartesian) for (var j = 0; j < 3; j++) tokens[j] = "" + this.parseFloatStr(tokens[j]) * this.scaleFac; + +var atom = this.addAtomXYZSymName(tokens, 0, null, label); +if (!Float.isNaN(radius)) atom.radius = radius * this.scaleFac; +if (this.asc.bsAtoms != null) this.asc.bsAtoms.set(atom.index); +} +}); +Clazz.defineMethod(c$, "getElement", +function(token){ +var s = null; +switch (token.length) { +default: +s = (token.length > 2 ? token.substring(0, 2) : null); +if (s != null && J.api.JmolAdapter.getElementNumber(s) >= 0) return s; +case 1: +if (J.api.JmolAdapter.getElementNumber(s = token.substring(0)) >= 0) return s; +case 0: +return null; +} +}, "~S"); +Clazz.defineMethod(c$, "rdline", +function(){ +this.rd(); +if (this.line != null && this.line.startsWith("[")) this.line = this.line.substring(this.line.indexOf("]") + 1).trim(); +return this.line; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/Wien2kReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/Wien2kReader.js new file mode 100755 index 000000000000..b0d2dd59772d --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/Wien2kReader.js @@ -0,0 +1,115 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.xtal.Wien2kReader", ["JU.PT"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.isrhombohedral = false; +this.latticeCode = '\0'; +this.doSymmetry = true; +this.cxyz = " x y z"; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "Wien2kReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.doSymmetry = !this.sgName.equals("none"); +this.setFractionalCoordinates(true); +this.asc.setCollectionName(this.rd()); +this.readUnitCell(); +this.readAtoms(); +this.readSymmetry(); +this.readEmbeddedScript(); +this.continuing = false; +}); +Clazz.defineMethod(c$, "readUnitCell", +function(){ +this.rd(); +this.isrhombohedral = ((this.latticeCode = this.line.charAt(0)) == 'R'); +if (this.line.startsWith("CYZ")) this.latticeCode = 'A'; + else if (this.line.startsWith("CXZ")) this.latticeCode = 'B'; + else if (this.line.startsWith("B")) this.latticeCode = 'I'; +if (this.latticeCode != 'R' && this.latticeCode != 'H') this.asc.getXSymmetry().setLatticeParameter(this.latticeCode.charCodeAt(0)); +if (this.line.length > 32) { +var name = this.line.substring(32).trim(); +if (name.indexOf(" ") >= 0) name = name.substring(name.indexOf(" ") + 1); +if (name.indexOf("_") >= 0) name = name.substring(name.indexOf("_") + 1); +this.setSpaceGroupName(name); +}var factor = (this.rd().toLowerCase().indexOf("ang") >= 0 ? 1 : 0.5291772); +this.rd(); +var a = this.parseFloatRange(this.line, 0, 10) * factor; +var b = this.parseFloatRange(this.line, 10, 20) * factor; +var c = this.parseFloatRange(this.line, 20, 30) * factor; +var l = this.line.length; +var alpha = (l >= 40 ? this.parseFloatRange(this.line, 30, 40) : 0); +var beta = (l >= 50 ? this.parseFloatRange(this.line, 40, 50) : 0); +var gamma = (l >= 60 ? this.parseFloatRange(this.line, 50, 60) : 0); +if (this.isrhombohedral) { +var ar = Math.sqrt(a * a / 3 + c * c / 9); +alpha = beta = gamma = (Math.acos((2 * c * c - 3 * a * a) / (2 * c * c + 6 * a * a)) * 180 / 3.141592653589793); +a = b = c = ar; +}if (Float.isNaN(alpha) || alpha == 0) alpha = 90; +if (Float.isNaN(beta) || beta == 0) beta = 90; +if (Float.isNaN(gamma) || gamma == 0) gamma = 90; +this.setUnitCell(a, b, c, alpha, beta, gamma); +}); +Clazz.defineMethod(c$, "readAtoms", +function(){ +this.rd(); +while (this.line != null && (this.line.indexOf("ATOM") == 0 || !this.doSymmetry && this.line.indexOf(":") == 8)) { +var thisAtom = this.asc.ac; +this.addAtom(); +if (this.rd().indexOf("MULT=") == 10) for (var i = this.parseIntRange(this.line, 15, 18); --i >= 0; ) { +this.rd(); +if (!this.doSymmetry) this.addAtom(); +} +var atomName = this.line.substring(0, 10); +var sym = atomName.substring(0, 2).trim(); +if (sym.length == 2 && JU.PT.isDigit(sym.charAt(1))) sym = sym.substring(0, 1); +atomName = JU.PT.rep(atomName, " ", ""); +var n = 0; +for (var i = this.asc.ac; --i >= thisAtom; ) { +var atom = this.asc.atoms[i]; +atom.elementSymbol = sym; +atom.atomName = atomName + "_" + (n++); +} +while (this.rd() != null && this.line.indexOf("ATOM") < 0 && this.line.indexOf("SYMMETRY") < 0) { +} +} +}); +Clazz.defineMethod(c$, "addAtom", +function(){ +var a = this.parseFloatRange(this.line, 12, 22); +var b = this.parseFloatRange(this.line, 25, 35); +var c = this.parseFloatRange(this.line, 38, 48); +var atom = this.asc.addNewAtom(); +this.setAtomCoordXYZ(atom, a, b, c); +}); +Clazz.defineMethod(c$, "readSymmetry", +function(){ +if (this.line.indexOf("SYMMETRY") < 0) return; +var n = this.parseIntRange(this.line, 0, 4); +for (var i = n; --i >= 0; ) { +var xyz = this.getJones() + "," + this.getJones() + "," + this.getJones(); +if (this.doSymmetry) this.setSymmetryOperator(xyz); +this.rd(); +} +}); +Clazz.defineMethod(c$, "getJones", +function(){ +this.rd(); +var xyz = ""; +var trans = this.parseFloatStr(this.line.substring(6)); +for (var i = 0; i < 6; i++) { +if (this.line.charAt(i) == '-') xyz += "-"; +if (this.line.charAt(++i) == '1') { +xyz += " x y z".charAt(i); +if (trans > 0) xyz += "+"; +if (trans != 0) xyz += trans; +}} +return xyz; +}); +Clazz.defineMethod(c$, "readEmbeddedScript", +function(){ +while (this.line != null) { +this.checkCurrentLineForScript(); +this.rd(); +} +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/XcrysdenReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/XcrysdenReader.js new file mode 100755 index 000000000000..3296b50e836a --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/readers/xtal/XcrysdenReader.js @@ -0,0 +1,72 @@ +Clazz.declarePackage("J.adapter.readers.xtal"); +Clazz.load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.xtal.XcrysdenReader", ["JU.PT"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.nAtoms = 0; +this.animation = false; +this.unitCellData = null; +this.animationStep = 0; +Clazz.instantialize(this, arguments);}, J.adapter.readers.xtal, "XcrysdenReader", J.adapter.smarter.AtomSetCollectionReader); +Clazz.prepareFields (c$, function(){ +this.unitCellData = Clazz.newFloatArray (9, 0); +}); +Clazz.overrideMethod(c$, "initializeReader", +function(){ +this.setFractionalCoordinates(false); +this.doApplySymmetry = true; +}); +Clazz.overrideMethod(c$, "checkLine", +function(){ +if (this.line.startsWith("ATOMS")) { +this.doApplySymmetry = false; +return this.readCoordinates(); +}if (this.line.contains("ANIMSTEP")) { +this.animation = true; +} else if (this.line.contains("PRIMVEC")) { +this.readUnitCell(); +} else if (this.line.contains("PRIMCOORD")) { +return this.readCoordinates(); +}return true; +}); +Clazz.defineMethod(c$, "readUnitCell", +function(){ +this.setSymmetry(); +this.fillFloatArray(null, 0, this.unitCellData); +this.setUnitCell(); +}); +Clazz.defineMethod(c$, "setUnitCell", +function(){ +this.addExplicitLatticeVector(0, this.unitCellData, 0); +this.addExplicitLatticeVector(1, this.unitCellData, 3); +this.addExplicitLatticeVector(2, this.unitCellData, 6); +}); +Clazz.defineMethod(c$, "setSymmetry", +function(){ +this.applySymmetryAndSetTrajectory(); +this.asc.newAtomSet(); +this.setSpaceGroupName("P1"); +this.setFractionalCoordinates(false); +}); +Clazz.defineMethod(c$, "readCoordinates", +function(){ +if (this.doApplySymmetry) { +var atomStr = JU.PT.getTokens(this.rd()); +this.nAtoms = Integer.parseInt(atomStr[0]); +} else { +this.nAtoms = 2147483647; +}this.setFractionalCoordinates(false); +var counter = 0; +while (counter < this.nAtoms && this.rd() != null) { +var tokens = this.getTokens(); +var an = JU.PT.parseInt(tokens[0]); +if (an < 0) { +break; +}this.line = null; +this.addAtomXYZSymName(tokens, 1, null, J.adapter.smarter.AtomSetCollectionReader.getElementSymbol(an)); +counter++; +} +this.asc.setAtomSetName(this.animation ? "Structure " + (++this.animationStep) : "Initial coordinates"); +if (this.line != null) this.setSymmetry(); +return (this.line == null); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/Atom.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/Atom.js new file mode 100755 index 000000000000..254dc949ce39 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/Atom.js @@ -0,0 +1,113 @@ +Clazz.declarePackage("J.adapter.smarter"); +Clazz.load(["JU.P3"], "J.adapter.smarter.Atom", ["JU.AU", "$.Lst", "$.V3"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.atomSetIndex = 0; +this.index = 0; +this.bsSymmetry = null; +this.atomSite = 0; +this.elementSymbol = null; +this.elementNumber = -1; +this.atomName = null; +this.formalCharge = -2147483648; +this.partialCharge = NaN; +this.vib = null; +this.bfactor = NaN; +this.foccupancy = 1; +this.radius = NaN; +this.isHetero = false; +this.atomSerial = -2147483648; +this.chainID = 0; +this.bondingRadius = NaN; +this.altLoc = '\0'; +this.group3 = null; +this.sequenceNumber = -2147483648; +this.insertionCode = '\0'; +this.anisoBorU = null; +this.tensors = null; +this.isNegDisorder = false; +this.typeSymbol = null; +Clazz.instantialize(this, arguments);}, J.adapter.smarter, "Atom", JU.P3, Cloneable); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.adapter.smarter.Atom, []); +this.set(NaN, NaN, NaN); +}); +Clazz.defineMethod(c$, "addTensor", +function(tensor, type, reset){ +if (tensor == null) return null; +if (reset || this.tensors == null) this.tensors = new JU.Lst(); +this.tensors.addLast(tensor); +if (type != null) tensor.setType(type); +return tensor; +}, "JU.Tensor,~S,~B"); +Clazz.defineMethod(c$, "getClone", +function(){ +var a; +try { +a = this.clone(); +} catch (e) { +if (Clazz.exceptionOf(e,"CloneNotSupportedException")){ +return null; +} else { +throw e; +} +} +if (this.vib != null) { +if (Clazz.instanceOf(this.vib,"JU.Vibration")) { +a.vib = (this.vib).clone(); +} else { +a.vib = JU.V3.newV(a.vib); +}}if (this.anisoBorU != null) a.anisoBorU = JU.AU.arrayCopyF(this.anisoBorU, -1); +if (this.tensors != null) { +a.tensors = new JU.Lst(); +for (var i = this.tensors.size(); --i >= 0; ) a.tensors.addLast((this.tensors.get(i)).copyTensor()); + +}return a; +}); +Clazz.defineMethod(c$, "getElementSymbol", +function(){ +if (this.elementSymbol == null && this.atomName != null) { +var len = this.atomName.length; +var ichFirst = 0; +var chFirst = String.fromCharCode(0); +while (ichFirst < len && !J.adapter.smarter.Atom.isValidSymChar1(chFirst = this.atomName.charAt(ichFirst))) ++ichFirst; + +switch (len - ichFirst) { +case 0: +break; +default: +var chSecond = this.atomName.charAt(ichFirst + 1); +if (J.adapter.smarter.Atom.isValidSymNoCase(chFirst, chSecond)) { +this.elementSymbol = "" + chFirst + chSecond; +break; +}case 1: +if (J.adapter.smarter.Atom.isValidSym1(chFirst)) this.elementSymbol = "" + chFirst; +break; +} +}return this.elementSymbol; +}); +c$.isValidSym1 = Clazz.defineMethod(c$, "isValidSym1", +function(ch){ +return (ch >= 'A' && ch <= 'Z' && J.adapter.smarter.Atom.elementCharMasks[ch.charCodeAt(0) - 65] < 0); +}, "~S"); +c$.isValidSym2 = Clazz.defineMethod(c$, "isValidSym2", +function(ch1, ch2){ +return (ch1 >= 'A' && ch1 <= 'Z' && ch2 >= 'a' && ch2 <= 'z' && ((J.adapter.smarter.Atom.elementCharMasks[ch1.charCodeAt(0) - 65] >> (ch2.charCodeAt(0) - 97)) & 1) != 0); +}, "~S,~S"); +c$.isValidSymNoCase = Clazz.defineMethod(c$, "isValidSymNoCase", +function(ch1, ch2){ +return J.adapter.smarter.Atom.isValidSym2(ch1, ch2 < 'a' ? String.fromCharCode(ch2.charCodeAt(0) + 32) : ch2); +}, "~S,~S"); +c$.isValidSymChar1 = Clazz.defineMethod(c$, "isValidSymChar1", +function(ch){ +return (ch >= 'A' && ch <= 'Z' && J.adapter.smarter.Atom.elementCharMasks[ch.charCodeAt(0) - 65] != 0); +}, "~S"); +Clazz.defineMethod(c$, "copyTo", +function(pt, asc){ +var a = asc.newCloneAtom(this); +a.setT(pt); +return a; +}, "JU.P3,J.adapter.smarter.AtomSetCollection"); +c$.elementCharMasks = Clazz.newIntArray(-1, [1972292, -2147351151, -2146019271, -2130706430, 1441792, -2147348464, 25, -2147205008, -2147344384, 0, -2147352576, 1179905, 548936, -2147434213, -2147221504, -2145759221, 0, 1056947, -2147339946, -2147477097, -2147483648, -2147483648, -2147483648, 8388624, -2147483646, 139264]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/AtomIterator.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/AtomIterator.js new file mode 100755 index 000000000000..d0629eba17fe --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/AtomIterator.js @@ -0,0 +1,126 @@ +Clazz.declarePackage("J.adapter.smarter"); +Clazz.load(["J.api.JmolAdapterAtomIterator"], "J.adapter.smarter.AtomIterator", ["J.api.JmolAdapter"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.iatom = 0; +this.atom = null; +this.ac = 0; +this.atoms = null; +this.bsAtoms = null; +Clazz.instantialize(this, arguments);}, J.adapter.smarter, "AtomIterator", null, J.api.JmolAdapterAtomIterator); +Clazz.makeConstructor(c$, +function(asc){ +this.ac = asc.ac; +this.atoms = asc.atoms; +this.bsAtoms = asc.bsAtoms; +this.iatom = 0; +}, "J.adapter.smarter.AtomSetCollection"); +Clazz.overrideMethod(c$, "hasNext", +function(){ +if (this.iatom == this.ac) return false; +while ((this.atom = this.atoms[this.iatom++]) == null || (this.bsAtoms != null && !this.bsAtoms.get(this.atom.index))) if (this.iatom == this.ac) return false; + +this.atoms[this.iatom - 1] = null; +return true; +}); +Clazz.overrideMethod(c$, "getAtomSetIndex", +function(){ +return this.atom.atomSetIndex; +}); +Clazz.overrideMethod(c$, "getSymmetry", +function(){ +return this.atom.bsSymmetry; +}); +Clazz.overrideMethod(c$, "getAtomSite", +function(){ +return this.atom.atomSite + 1; +}); +Clazz.overrideMethod(c$, "getUniqueID", +function(){ +return Integer.$valueOf(this.atom.index); +}); +Clazz.overrideMethod(c$, "getElementNumber", +function(){ +return (this.atom.elementNumber > 0 ? this.atom.elementNumber : J.api.JmolAdapter.getElementNumber(this.atom.getElementSymbol())); +}); +Clazz.overrideMethod(c$, "getAtomName", +function(){ +return this.atom.atomName; +}); +Clazz.overrideMethod(c$, "getFormalCharge", +function(){ +return (this.atom.formalCharge == -2147483648 ? 0 : this.atom.formalCharge); +}); +Clazz.overrideMethod(c$, "getPartialCharge", +function(){ +return this.atom.partialCharge; +}); +Clazz.overrideMethod(c$, "getTensors", +function(){ +return this.atom.tensors; +}); +Clazz.overrideMethod(c$, "getRadius", +function(){ +return this.atom.radius; +}); +Clazz.overrideMethod(c$, "getBondRadius", +function(){ +return this.atom.bondingRadius; +}); +Clazz.overrideMethod(c$, "getVib", +function(){ +return (this.atom.vib == null || Float.isNaN(this.atom.vib.z) ? null : this.atom.vib); +}); +Clazz.overrideMethod(c$, "getSeqID", +function(){ +return (this.atom.vib == null || !Float.isNaN(this.atom.vib.y) || this.atom.vib.z != 1094713365 ? 0 : Clazz.floatToInt(this.atom.vib.x)); +}); +Clazz.overrideMethod(c$, "getBfactor", +function(){ +return this.atom.bfactor; +}); +Clazz.overrideMethod(c$, "getOccupancy", +function(){ +return this.atom.foccupancy * 100; +}); +Clazz.overrideMethod(c$, "getIsHetero", +function(){ +return this.atom.isHetero; +}); +Clazz.overrideMethod(c$, "getSerial", +function(){ +return this.atom.atomSerial; +}); +Clazz.overrideMethod(c$, "getChainID", +function(){ +return this.atom.chainID; +}); +Clazz.overrideMethod(c$, "getAltLoc", +function(){ +return J.api.JmolAdapter.canonizeAlternateLocationID(this.atom.altLoc); +}); +Clazz.overrideMethod(c$, "getGroup3", +function(){ +return this.atom.group3; +}); +Clazz.overrideMethod(c$, "getSequenceNumber", +function(){ +return this.atom.sequenceNumber; +}); +Clazz.overrideMethod(c$, "getInsertionCode", +function(){ +return J.api.JmolAdapter.canonizeInsertionCode(this.atom.insertionCode); +}); +Clazz.overrideMethod(c$, "getXYZ", +function(){ +return this.atom; +}); +Clazz.overrideMethod(c$, "getElement", +function(){ +return this.getElementNumber() & 0x7F; +}); +Clazz.overrideMethod(c$, "getIsotope", +function(){ +return this.getElementNumber() >> 7; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/AtomSetCollection.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/AtomSetCollection.js new file mode 100755 index 000000000000..ac1829901019 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/AtomSetCollection.js @@ -0,0 +1,880 @@ +Clazz.declarePackage("J.adapter.smarter"); +Clazz.load(["java.util.Hashtable"], "J.adapter.smarter.AtomSetCollection", ["java.util.Collections", "$.Properties", "JU.AU", "$.BS", "$.Lst", "$.P3", "$.V3", "J.adapter.smarter.Atom", "$.Bond", "$.SmarterJmolAdapter", "J.api.Interface", "JU.BSUtil", "$.Logger", "JV.JC"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.reader = null; +this.bsAtoms = null; +this.fileTypeName = null; +this.collectionName = null; +this.atomSetInfo = null; +this.atoms = null; +this.ac = 0; +this.bonds = null; +this.bondCount = 0; +this.structures = null; +this.structureCount = 0; +this.atomSetCount = 0; +this.iSet = -1; +this.atomSetNumbers = null; +this.atomSetAtomIndexes = null; +this.atomSetAtomCounts = null; +this.atomSetBondCounts = null; +this.atomSetAuxiliaryInfo = null; +this.errorMessage = null; +this.coordinatesAreFractional = false; +this.isTrajectory = false; +this.trajectoryStepCount = 0; +this.trajectorySteps = null; +this.vibrationSteps = null; +this.trajectoryNames = null; +this.doFixPeriodic = false; +this.allowMultiple = false; +this.readerList = null; +this.atomMapAnyCase = false; +this.fixedSite = 0; +this.bsStructuredModels = null; +this.haveAnisou = false; +this.baseSymmetryAtomCount = 0; +this.crystalReaderLatticeOpsOnly = false; +this.xtalSymmetry = null; +this.bondIndex0 = 0; +this.atomSymbolicMap = null; +this.haveUnitCell = false; +this.vibScale = 0; +this.firstAtomToBond = -1; +Clazz.instantialize(this, arguments);}, J.adapter.smarter, "AtomSetCollection", null); +Clazz.prepareFields (c$, function(){ +this.atomSetInfo = new java.util.Hashtable(); +this.atoms = new Array(256); +this.bonds = new Array(256); +this.structures = new Array(16); +this.atomSetNumbers = Clazz.newIntArray (16, 0); +this.atomSetAtomIndexes = Clazz.newIntArray (16, 0); +this.atomSetAtomCounts = Clazz.newIntArray (16, 0); +this.atomSetBondCounts = Clazz.newIntArray (16, 0); +this.atomSetAuxiliaryInfo = new Array(16); +this.atomSymbolicMap = new java.util.Hashtable(); +}); +Clazz.makeConstructor(c$, +function(fileTypeName, reader, array, list){ +this.fileTypeName = fileTypeName; +this.reader = reader; +this.allowMultiple = (reader == null || reader.desiredVibrationNumber < 0); +var p = new java.util.Properties(); +p.put("PATH_KEY", ".PATH"); +p.put("PATH_SEPARATOR", J.adapter.smarter.SmarterJmolAdapter.PATH_SEPARATOR); +this.setInfo("properties", p); +if (reader != null) { +var ii = reader.htParams.get("appendToModelIndex"); +if (ii != null) this.setInfo("appendToModelIndex", ii); +ii = reader.htParams.get("fixedSite"); +if (ii != null) this.fixedSite = ii.intValue(); +}if (array != null) { +var n = 0; +this.readerList = new JU.Lst(); +for (var i = 0; i < array.length; i++) if (array[i] != null && (array[i].ac > 0 || array[i].reader != null && array[i].reader.mustFinalizeModelSet)) this.appendAtomSetCollection(n++, array[i]); + +if (n > 1) this.setInfo("isMultiFile", Boolean.TRUE); +} else if (list != null) { +this.setInfo("isMultiFile", Boolean.TRUE); +this.appendAtomSetCollectionList(list); +}}, "~S,J.adapter.smarter.AtomSetCollectionReader,~A,JU.Lst"); +Clazz.defineMethod(c$, "setCollectionName", +function(collectionName){ +if (collectionName != null && (collectionName = collectionName.trim()).length > 0) this.collectionName = collectionName; +}, "~S"); +Clazz.defineMethod(c$, "clearGlobalBoolean", +function(globalIndex){ +this.atomSetInfo.remove(JV.JC.getBoolName(globalIndex)); +}, "~N"); +Clazz.defineMethod(c$, "setGlobalBoolean", +function(globalIndex){ +this.setInfo(JV.JC.getBoolName(globalIndex), Boolean.TRUE); +}, "~N"); +Clazz.defineMethod(c$, "getGlobalBoolean", +function(globalIndex){ +return (this.atomSetInfo.get(JV.JC.getBoolName(globalIndex)) === Boolean.TRUE); +}, "~N"); +Clazz.defineMethod(c$, "appendAtomSetCollectionList", +function(list){ +var n = list.size(); +if (n == 0) { +this.errorMessage = "No file found!"; +return; +}for (var i = 0; i < n; i++) { +var o = list.get(i); +if (Clazz.instanceOf(o,"JU.Lst")) this.appendAtomSetCollectionList(o); + else this.appendAtomSetCollection(i, o); +} +}, "JU.Lst"); +Clazz.defineMethod(c$, "setTrajectory", +function(){ +if (!this.isTrajectory) this.trajectorySteps = new JU.Lst(); +this.isTrajectory = true; +var n = (this.bsAtoms == null ? this.ac : this.bsAtoms.cardinality()); +if (n <= 1) return; +var trajectoryStep = new Array(n); +var haveVibrations = (n > 0 && this.atoms[0].vib != null && !Float.isNaN(this.atoms[0].vib.z)); +var vibrationStep = (haveVibrations ? new Array(n) : null); +var prevSteps = (this.trajectoryStepCount == 0 ? null : this.trajectorySteps.get(this.trajectoryStepCount - 1)); +for (var i = 0, ii = 0; i < this.ac; i++) { +if (this.bsAtoms != null && !this.bsAtoms.get(i)) continue; +var pt = JU.P3.newP(this.atoms[i]); +if (this.doFixPeriodic && prevSteps != null) pt = J.adapter.smarter.AtomSetCollection.fixPeriodic(pt, prevSteps[i]); +trajectoryStep[ii] = pt; +if (haveVibrations) vibrationStep[ii] = this.atoms[i].vib; +ii++; +} +if (haveVibrations) { +if (this.vibrationSteps == null) { +this.vibrationSteps = new JU.Lst(); +for (var i = 0; i < this.trajectoryStepCount; i++) this.vibrationSteps.addLast(null); + +}this.vibrationSteps.addLast(vibrationStep); +}this.trajectorySteps.addLast(trajectoryStep); +this.trajectoryStepCount++; +}); +Clazz.defineMethod(c$, "appendAtomSetCollection", +function(collectionIndex, collection){ +if (collection.reader != null && collection.reader.mustFinalizeModelSet) this.readerList.addLast(collection.reader); +var existingAtomsCount = this.ac; +this.setInfo("loadState", collection.atomSetInfo.get("loadState")); +if (collection.bsAtoms != null) { +this.getBSAtoms(0); +for (var i = collection.bsAtoms.nextSetBit(0); i >= 0; i = collection.bsAtoms.nextSetBit(i + 1)) this.bsAtoms.set(existingAtomsCount + i); + +}var clonedAtoms = 0; +var atomSetCount0 = this.atomSetCount; +for (var atomSetNum = 0; atomSetNum < collection.atomSetCount; atomSetNum++) { +this.newAtomSet(); +var info = this.atomSetAuxiliaryInfo[this.iSet] = collection.atomSetAuxiliaryInfo[atomSetNum]; +var atomInfo = info.get("PDB_CONECT_firstAtom_count_max"); +if (atomInfo != null) atomInfo[0] += existingAtomsCount; +this.setCurrentModelInfo("title", collection.collectionName); +this.setAtomSetName(collection.getAtomSetName(atomSetNum)); +for (var atomNum = 0; atomNum < collection.atomSetAtomCounts[atomSetNum]; atomNum++) { +if (this.bsAtoms != null) this.bsAtoms.set(this.ac); +this.newCloneAtom(collection.atoms[clonedAtoms]); +clonedAtoms++; +} +this.atomSetNumbers[this.iSet] = (collectionIndex < 0 ? this.iSet + 1 : ((collectionIndex + 1) * 1000000) + collection.atomSetNumbers[atomSetNum]); +} +for (var bondNum = 0; bondNum < collection.bondCount; bondNum++) { +var bond = collection.bonds[bondNum]; +this.addNewBondWithOrder(bond.atomIndex1 + existingAtomsCount, bond.atomIndex2 + existingAtomsCount, bond.order); +} +for (var i = JV.JC.globalBooleans.length; --i >= 0; ) if (collection.getGlobalBoolean(i)) this.setGlobalBoolean(i); + +for (var i = 0; i < collection.structureCount; i++) { +var s = collection.structures[i]; +this.addStructure(s); +s.modelStartEnd[0] += atomSetCount0; +s.modelStartEnd[1] += atomSetCount0; +} +}, "~N,J.adapter.smarter.AtomSetCollection"); +Clazz.defineMethod(c$, "setNoAutoBond", +function(){ +this.setInfo("noAutoBond", Boolean.TRUE); +}); +Clazz.defineMethod(c$, "freeze", +function(reverseModels){ +if (this.atomSetCount == 1 && this.collectionName == null) this.collectionName = this.getAtomSetAuxiliaryInfoValue(0, "name"); +if (reverseModels) this.reverseAtomSets(); +if (this.trajectoryStepCount > 1) this.finalizeTrajectory(); +this.getList(true); +this.getList(false); +for (var i = 0; i < this.atomSetCount; i++) { +this.setModelInfoForSet("initialAtomCount", Integer.$valueOf(this.atomSetAtomCounts[i]), i); +this.setModelInfoForSet("initialBondCount", Integer.$valueOf(this.atomSetBondCounts[i]), i); +} +}, "~B"); +Clazz.defineMethod(c$, "reverseAtomSets", +function(){ +this.reverseArray(this.atomSetAtomIndexes); +this.reverseArray(this.atomSetNumbers); +this.reverseArray(this.atomSetAtomCounts); +this.reverseArray(this.atomSetBondCounts); +J.adapter.smarter.AtomSetCollection.reverseList(this.trajectorySteps); +J.adapter.smarter.AtomSetCollection.reverseList(this.trajectoryNames); +J.adapter.smarter.AtomSetCollection.reverseList(this.vibrationSteps); +this.reverseObject(this.atomSetAuxiliaryInfo); +for (var i = 0; i < this.ac; i++) this.atoms[i].atomSetIndex = this.atomSetCount - 1 - this.atoms[i].atomSetIndex; + +for (var i = 0; i < this.structureCount; i++) { +var m = this.structures[i].modelStartEnd[0]; +if (m >= 0) { +this.structures[i].modelStartEnd[0] = this.atomSetCount - 1 - this.structures[i].modelStartEnd[1]; +this.structures[i].modelStartEnd[1] = this.atomSetCount - 1 - m; +}} +for (var i = 0; i < this.bondCount; i++) this.bonds[i].atomSetIndex = this.atomSetCount - 1 - this.atoms[this.bonds[i].atomIndex1].atomSetIndex; + +this.reverseSets(this.bonds, this.bondCount); +var lists = JU.AU.createArrayOfArrayList(this.atomSetCount); +for (var i = 0; i < this.atomSetCount; i++) lists[i] = new JU.Lst(); + +for (var i = 0; i < this.ac; i++) lists[this.atoms[i].atomSetIndex].addLast(this.atoms[i]); + +var newIndex = Clazz.newIntArray (this.ac, 0); +var n = this.ac; +for (var i = this.atomSetCount; --i >= 0; ) for (var j = lists[i].size(); --j >= 0; ) { +var a = this.atoms[--n] = lists[i].get(j); +newIndex[a.index] = n; +a.index = n; +} + +for (var i = 0; i < this.bondCount; i++) { +this.bonds[i].atomIndex1 = newIndex[this.bonds[i].atomIndex1]; +this.bonds[i].atomIndex2 = newIndex[this.bonds[i].atomIndex2]; +} +for (var i = 0; i < this.atomSetCount; i++) { +var conect = this.getAtomSetAuxiliaryInfoValue(i, "PDB_CONECT_firstAtom_count_max"); +if (conect == null) continue; +conect[0] = newIndex[conect[0]]; +conect[1] = this.atomSetAtomCounts[i]; +} +}); +Clazz.defineMethod(c$, "reverseSets", +function(o, n){ +var lists = JU.AU.createArrayOfArrayList(this.atomSetCount); +for (var i = 0; i < this.atomSetCount; i++) lists[i] = new JU.Lst(); + +for (var i = 0; i < n; i++) { +var index = o[i].atomSetIndex; +if (index < 0) return; +lists[o[i].atomSetIndex].addLast(o[i]); +} +for (var i = this.atomSetCount; --i >= 0; ) for (var j = lists[i].size(); --j >= 0; ) o[--n] = lists[i].get(j); + + +}, "~A,~N"); +Clazz.defineMethod(c$, "reverseObject", +function(o){ +var n = this.atomSetCount; +for (var i = Clazz.doubleToInt(n / 2); --i >= 0; ) JU.AU.swap(o, i, n - 1 - i); + +}, "~A"); +c$.reverseList = Clazz.defineMethod(c$, "reverseList", +function(list){ +if (list == null) return; +java.util.Collections.reverse(list); +}, "JU.Lst"); +Clazz.defineMethod(c$, "reverseArray", +function(a){ +var n = this.atomSetCount; +for (var i = Clazz.doubleToInt(n / 2); --i >= 0; ) JU.AU.swapInt(a, i, n - 1 - i); + +}, "~A"); +Clazz.defineMethod(c$, "getList", +function(isAltLoc){ +var i; +for (i = this.ac; --i >= 0; ) if (this.atoms[i] != null && (isAltLoc ? this.atoms[i].altLoc : this.atoms[i].insertionCode) != '\0') break; + +if (i < 0) return; +var lists = new Array(this.atomSetCount); +for (i = 0; i < this.atomSetCount; i++) lists[i] = ""; + +var pt; +for (i = 0; i < this.ac; i++) { +if (this.atoms[i] == null) continue; +var id = (isAltLoc ? this.atoms[i].altLoc : this.atoms[i].insertionCode); +if (id != '\0' && lists[pt = this.atoms[i].atomSetIndex].indexOf(id) < 0) lists[pt] += id; +} +var type = (isAltLoc ? "altLocs" : "insertionCodes"); +for (i = 0; i < this.atomSetCount; i++) if (lists[i].length > 0) this.setModelInfoForSet(type, lists[i], i); + +}, "~B"); +Clazz.defineMethod(c$, "finish", +function(){ +if (this.reader != null) this.reader.finalizeModelSet(); + else if (this.readerList != null) for (var i = 0; i < this.readerList.size(); i++) this.readerList.get(i).finalizeModelSet(); + +this.atoms = null; +this.atomSetAtomCounts = Clazz.newIntArray (16, 0); +this.atomSetAuxiliaryInfo = new Array(16); +this.atomSetInfo = new java.util.Hashtable(); +this.atomSetCount = 0; +this.atomSetNumbers = Clazz.newIntArray (16, 0); +this.atomSymbolicMap = new java.util.Hashtable(); +this.bonds = null; +this.iSet = -1; +this.readerList = null; +this.xtalSymmetry = null; +this.structures = new Array(16); +this.structureCount = 0; +this.trajectorySteps = null; +this.vibrationSteps = null; +}); +Clazz.defineMethod(c$, "discardPreviousAtoms", +function(){ +for (var i = this.ac; --i >= 0; ) this.atoms[i] = null; + +this.ac = 0; +this.clearMap(); +this.atomSetCount = 0; +this.iSet = -1; +for (var i = this.atomSetAuxiliaryInfo.length; --i >= 0; ) { +this.atomSetAtomCounts[i] = 0; +this.atomSetBondCounts[i] = 0; +this.atomSetAuxiliaryInfo[i] = null; +} +}); +Clazz.defineMethod(c$, "removeCurrentAtomSet", +function(){ +if (this.iSet < 0) return; +var ai = this.atomSetAtomIndexes[this.iSet]; +if (this.bsAtoms != null) this.bsAtoms.clearBits(ai, this.ac); +this.ac = ai; +this.atomSetAtomCounts[this.iSet] = 0; +this.iSet--; +this.atomSetCount--; +this.reader.doCheckUnitCell = false; +}); +Clazz.defineMethod(c$, "getHydrogenAtomCount", +function(){ +var n = 0; +for (var i = 0; i < this.ac; i++) if (this.atoms[i].elementNumber == 1 || this.atoms[i].elementSymbol.equals("H")) n++; + +return n; +}); +Clazz.defineMethod(c$, "newCloneAtom", +function(atom){ +var clone = atom.getClone(); +this.addAtom(clone); +return clone; +}, "J.adapter.smarter.Atom"); +Clazz.defineMethod(c$, "cloneFirstAtomSet", +function(atomCount){ +if (!this.allowMultiple) return 0; +this.newAtomSet(); +if (atomCount == 0) atomCount = this.atomSetAtomCounts[0]; +for (var i = 0; i < atomCount; ++i) this.newCloneAtom(this.atoms[i]); + +return this.ac; +}, "~N"); +Clazz.defineMethod(c$, "cloneAtomSetWithBonds", +function(isLast){ +var nBonds = this.atomSetBondCounts[isLast ? this.iSet : 0]; +var atomIncrement = (isLast ? this.cloneLastAtomSet() : this.cloneFirstAtomSet(0)); +if (atomIncrement > 0) for (var i = 0; i < nBonds; i++) { +var bond = this.bonds[this.bondCount - nBonds]; +this.addNewBondWithOrder(bond.atomIndex1 + atomIncrement, bond.atomIndex2 + atomIncrement, bond.order); +} +}, "~B"); +Clazz.defineMethod(c$, "cloneLastAtomSet", +function(){ +return this.cloneLastAtomSetFromPoints(0, null); +}); +Clazz.defineMethod(c$, "cloneLastAtomSetFromPoints", +function(ac, pts){ +if (!this.allowMultiple) return 0; +var count = (ac > 0 ? ac : this.getLastAtomSetAtomCount()); +var atomIndex = this.getLastAtomSetAtomIndex(); +this.newAtomSet(); +for (var i = 0; i < count; ++i) { +var atom = this.newCloneAtom(this.atoms[atomIndex++]); +if (pts != null) atom.setT(pts[i]); +} +return count; +}, "~N,~A"); +Clazz.defineMethod(c$, "getLastAtomSetAtomCount", +function(){ +return this.atomSetAtomCounts[this.iSet]; +}); +Clazz.defineMethod(c$, "getLastAtomSetAtomIndex", +function(){ +return this.ac - this.atomSetAtomCounts[this.iSet]; +}); +Clazz.defineMethod(c$, "addNewAtom", +function(){ +return this.addAtom( new J.adapter.smarter.Atom()); +}); +Clazz.defineMethod(c$, "addAtom", +function(atom){ +if (this.ac == this.atoms.length) { +if (this.ac > 200000) this.atoms = JU.AU.ensureLength(this.atoms, this.ac + 50000); + else this.atoms = JU.AU.doubleLength(this.atoms); +}if (this.atomSetCount == 0) this.newAtomSet(); +atom.index = this.ac; +this.atoms[this.ac++] = atom; +atom.atomSetIndex = this.iSet; +atom.atomSite = (this.fixedSite > 0 ? this.fixedSite - 1 : this.atomSetAtomCounts[this.iSet]++); +return atom; +}, "J.adapter.smarter.Atom"); +Clazz.defineMethod(c$, "addAtomWithMappedName", +function(atom){ +var atomName = this.addAtom(atom).atomName; +if (atomName != null) this.atomSymbolicMap.put(atomName, atom); +}, "J.adapter.smarter.Atom"); +Clazz.defineMethod(c$, "addAtomWithMappedSerialNumber", +function(atom){ +var atomSerial = this.addAtom(atom).atomSerial; +if (atomSerial != -2147483648) this.atomSymbolicMap.put("" + atomSerial, atom); +}, "J.adapter.smarter.Atom"); +Clazz.defineMethod(c$, "getAtomFromName", +function(atomName){ +return this.atomSymbolicMap.get(atomName); +}, "~S"); +Clazz.defineMethod(c$, "setAtomMapAnyCase", +function(){ +this.atomMapAnyCase = true; +var newMap = new java.util.Hashtable(); +newMap.putAll(this.atomSymbolicMap); +for (var e, $e = this.atomSymbolicMap.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) { +var name = e.getKey(); +var uc = name.toUpperCase(); +if (!uc.equals(name)) newMap.put(uc, e.getValue()); +} +this.atomSymbolicMap = newMap; +}); +Clazz.defineMethod(c$, "getAtomIndex", +function(name){ +var a = this.atomSymbolicMap.get(name); +if (a == null && this.atomMapAnyCase) a = this.atomSymbolicMap.get(name.toUpperCase()); +return (a == null ? -1 : a.index); +}, "~S"); +Clazz.defineMethod(c$, "addNewBondWithOrder", +function(atomIndex1, atomIndex2, order){ +var b = null; +if (atomIndex1 >= 0 && atomIndex1 < this.ac && atomIndex2 >= 0 && atomIndex2 < this.ac && atomIndex1 != atomIndex2) { +b = new J.adapter.smarter.Bond(atomIndex1, atomIndex2, order); +this.addBond(b); +}return b; +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "addNewBondFromNames", +function(atomName1, atomName2, order){ +return this.addNewBondWithOrderA(this.getAtomFromName(atomName1), this.getAtomFromName(atomName2), order); +}, "~S,~S,~N"); +Clazz.defineMethod(c$, "addNewBondWithOrderA", +function(atom1, atom2, order){ +return (atom1 != null && atom2 != null ? this.addNewBondWithOrder(atom1.index, atom2.index, order) : null); +}, "J.adapter.smarter.Atom,J.adapter.smarter.Atom,~N"); +Clazz.defineMethod(c$, "addBond", +function(bond){ +if (this.trajectoryStepCount > 0) return; +if (bond.atomIndex1 < 0 || bond.atomIndex2 < 0 || bond.order < 0 || bond.atomIndex1 == bond.atomIndex2 || this.atoms[bond.atomIndex1].atomSetIndex != this.atoms[bond.atomIndex2].atomSetIndex) { +if (JU.Logger.debugging) { +JU.Logger.debug(">>>>>>BAD BOND:" + bond.atomIndex1 + "-" + bond.atomIndex2 + " order=" + bond.order); +}return; +}this.addBondNoCheck(bond); +}, "J.adapter.smarter.Bond"); +Clazz.defineMethod(c$, "addBondNoCheck", +function(bond){ +if (this.bondCount == this.bonds.length) this.bonds = JU.AU.arrayCopyObject(this.bonds, this.bondCount + 1024); +this.bonds[this.bondCount++] = bond; +this.atomSetBondCounts[this.iSet]++; +}, "J.adapter.smarter.Bond"); +Clazz.defineMethod(c$, "finalizeStructures", +function(){ +if (this.structureCount == 0) return; +this.bsStructuredModels = new JU.BS(); +var map = new java.util.Hashtable(); +for (var i = 0; i < this.structureCount; i++) { +var s = this.structures[i]; +if (s.modelStartEnd[0] == -1) { +s.modelStartEnd[0] = 0; +s.modelStartEnd[1] = this.atomSetCount - 1; +}this.bsStructuredModels.setBits(s.modelStartEnd[0], s.modelStartEnd[1] + 1); +if (s.strandCount == 0) continue; +var key = s.structureID + " " + s.modelStartEnd[0]; +var v = map.get(key); +var count = (v == null ? 0 : v.intValue()) + 1; +map.put(key, Integer.$valueOf(count)); +} +for (var i = 0; i < this.structureCount; i++) { +var s = this.structures[i]; +if (s.strandCount == 1) s.strandCount = map.get(s.structureID + " " + s.modelStartEnd[0]).intValue(); +} +}); +Clazz.defineMethod(c$, "addStructure", +function(structure){ +if (this.structureCount == this.structures.length) this.structures = JU.AU.arrayCopyObject(this.structures, this.structureCount + 32); +this.structures[this.structureCount++] = structure; +}, "J.adapter.smarter.Structure"); +Clazz.defineMethod(c$, "addVibrationVectorWithSymmetry", +function(iatom, vx, vy, vz, withSymmetry){ +if (!withSymmetry) { +this.addVibrationVector(iatom, vx, vy, vz); +return; +}var atomSite = this.atoms[iatom].atomSite; +var atomSetIndex = this.atoms[iatom].atomSetIndex; +for (var i = iatom; i < this.ac && this.atoms[i].atomSetIndex == atomSetIndex; i++) { +if (this.atoms[i].atomSite == atomSite) this.addVibrationVector(i, vx, vy, vz); +} +}, "~N,~N,~N,~N,~B"); +Clazz.defineMethod(c$, "addVibrationVector", +function(iatom, x, y, z){ +if (!this.allowMultiple) iatom = iatom % this.ac; +return (this.atoms[iatom].vib = JU.V3.new3(x, y, z)); +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "setCoordinatesAreFractional", +function(tf){ +this.coordinatesAreFractional = tf; +this.setCurrentModelInfo("coordinatesAreFractional", Boolean.$valueOf(tf)); +if (tf) this.setGlobalBoolean(0); +}, "~B"); +Clazz.defineMethod(c$, "setAnisoBorU", +function(atom, data, type){ +this.haveAnisou = true; +atom.anisoBorU = data; +data[6] = type; +}, "J.adapter.smarter.Atom,~A,~N"); +Clazz.defineMethod(c$, "setU", +function(atom, i, val){ +var data = atom.anisoBorU; +if (data == null) this.setAnisoBorU(atom, data = Clazz.newFloatArray (8, 0), 8); +data[i] = val; +}, "J.adapter.smarter.Atom,~N,~N"); +Clazz.defineMethod(c$, "getXSymmetry", +function(){ +if (this.xtalSymmetry == null) this.xtalSymmetry = (J.api.Interface.getOption("adapter.smarter.XtalSymmetry", this.reader.vwr, "file")).set(this.reader); +return this.xtalSymmetry; +}); +Clazz.defineMethod(c$, "getSymmetry", +function(){ +return this.getXSymmetry().getSymmetry(); +}); +Clazz.defineMethod(c$, "setSymmetry", +function(symmetry){ +return (symmetry == null ? null : this.getXSymmetry().setSymmetry(symmetry)); +}, "J.adapter.smarter.XtalSymmetry.FileSymmetry"); +Clazz.defineMethod(c$, "newFileSymmetry", +function(){ +return this.getXSymmetry().newFileSymmetry(); +}); +Clazz.defineMethod(c$, "setTensors", +function(){ +if (this.haveAnisou) this.getXSymmetry().setTensors(); +}); +Clazz.defineMethod(c$, "setInfo", +function(key, value){ +if (value == null) this.atomSetInfo.remove(key); + else this.atomSetInfo.put(key, value); +}, "~S,~O"); +Clazz.defineMethod(c$, "setAtomSetCollectionPartialCharges", +function(auxKey){ +if (!this.atomSetInfo.containsKey(auxKey)) return false; +var atomData = this.atomSetInfo.get(auxKey); +var n = atomData.size(); +for (var i = this.ac; --i >= 0; ) this.atoms[i].partialCharge = atomData.get(i % n).floatValue(); + +JU.Logger.info("Setting partial charges type " + auxKey); +return true; +}, "~S"); +Clazz.defineMethod(c$, "mapPartialCharge", +function(atomName, charge){ +this.getAtomFromName(atomName).partialCharge = charge; +}, "~S,~N"); +c$.fixPeriodic = Clazz.defineMethod(c$, "fixPeriodic", +function(pt, pt0){ +pt.x = J.adapter.smarter.AtomSetCollection.fixPoint(pt.x, pt0.x); +pt.y = J.adapter.smarter.AtomSetCollection.fixPoint(pt.y, pt0.y); +pt.z = J.adapter.smarter.AtomSetCollection.fixPoint(pt.z, pt0.z); +return pt; +}, "JU.P3,JU.P3"); +c$.fixPoint = Clazz.defineMethod(c$, "fixPoint", +function(x, x0){ +while (x - x0 > 0.9) { +x -= 1; +} +while (x - x0 < -0.9) { +x += 1; +} +return x; +}, "~N,~N"); +Clazz.defineMethod(c$, "finalizeTrajectoryAs", +function(trajectorySteps, vibrationSteps){ +this.trajectorySteps = trajectorySteps; +this.vibrationSteps = vibrationSteps; +this.trajectoryStepCount = trajectorySteps.size(); +this.finalizeTrajectory(); +}, "JU.Lst,JU.Lst"); +Clazz.defineMethod(c$, "finalizeTrajectory", +function(){ +if (this.trajectoryStepCount == 0) return; +var trajectory = this.trajectorySteps.get(0); +var vibrations = (this.vibrationSteps == null ? null : this.vibrationSteps.get(0)); +var n = (this.bsAtoms == null ? this.ac : this.bsAtoms.cardinality()); +if (this.vibrationSteps != null && vibrations != null && vibrations.length < n || trajectory.length < n) { +this.errorMessage = "File cannot be loaded as a trajectory"; +return; +}var v = new JU.V3(); +for (var i = 0, ii = 0; i < this.ac; i++) { +if (this.bsAtoms != null && !this.bsAtoms.get(i)) continue; +if (this.vibrationSteps != null) this.atoms[i].vib = (vibrations == null ? v : vibrations[ii]); +if (trajectory[ii] != null) this.atoms[i].setT(trajectory[ii]); +ii++; +} +this.setInfo("trajectorySteps", this.trajectorySteps); +if (this.vibrationSteps != null) this.setInfo("vibrationSteps", this.vibrationSteps); +if (this.ac == 0) this.ac = trajectory.length; +}); +Clazz.defineMethod(c$, "newAtomSet", +function(){ +this.newAtomSetClear(true); +}); +Clazz.defineMethod(c$, "newAtomSetClear", +function(doClearMap){ +if (!this.allowMultiple && this.iSet >= 0) this.reader.discardPreviousAtoms(); +this.bondIndex0 = this.bondCount; +if (this.isTrajectory) this.reader.discardPreviousAtoms(); +this.iSet = this.atomSetCount++; +if (this.atomSetCount > this.atomSetNumbers.length) { +this.atomSetAtomIndexes = JU.AU.doubleLengthI(this.atomSetAtomIndexes); +this.atomSetAtomCounts = JU.AU.doubleLengthI(this.atomSetAtomCounts); +this.atomSetBondCounts = JU.AU.doubleLengthI(this.atomSetBondCounts); +this.atomSetAuxiliaryInfo = JU.AU.doubleLength(this.atomSetAuxiliaryInfo); +}this.atomSetAtomIndexes[this.iSet] = this.ac; +if (this.atomSetCount + this.trajectoryStepCount > this.atomSetNumbers.length) { +this.atomSetNumbers = JU.AU.doubleLengthI(this.atomSetNumbers); +}if (this.isTrajectory) { +this.atomSetNumbers[this.iSet + this.trajectoryStepCount] = this.atomSetCount + this.trajectoryStepCount; +} else { +this.atomSetNumbers[this.iSet] = this.atomSetCount; +}if (doClearMap) { +this.clearMap(); +}this.setCurrentModelInfo("title", this.collectionName); +}, "~B"); +Clazz.defineMethod(c$, "clearMap", +function(){ +this.atomSymbolicMap.clear(); +this.atomMapAnyCase = false; +}); +Clazz.defineMethod(c$, "getAtomSetAtomIndex", +function(i){ +return this.atomSetAtomIndexes[i]; +}, "~N"); +Clazz.defineMethod(c$, "getAtomSetAtomCount", +function(i){ +return this.atomSetAtomCounts[i]; +}, "~N"); +Clazz.defineMethod(c$, "getAtomSetBondCount", +function(i){ +return this.atomSetBondCounts[i]; +}, "~N"); +Clazz.defineMethod(c$, "setAtomSetName", +function(atomSetName){ +if (atomSetName == null) return; +if (this.isTrajectory) { +this.setTrajectoryName(atomSetName); +return; +}var name0 = (this.iSet < 0 ? null : this.getAtomSetName(this.iSet)); +this.setModelInfoForSet("name", atomSetName, this.iSet); +if (this.reader != null && atomSetName.length > 0 && !atomSetName.equals(name0)) this.reader.appendLoadNote(atomSetName); +if (!this.allowMultiple) this.setCollectionName(atomSetName); +}, "~S"); +Clazz.defineMethod(c$, "setTrajectoryName", +function(name){ +if (this.trajectoryStepCount == 0) return; +if (this.trajectoryNames == null) { +this.trajectoryNames = new JU.Lst(); +}for (var i = this.trajectoryNames.size(); i < this.trajectoryStepCount; i++) this.trajectoryNames.addLast(null); + +this.trajectoryNames.set(this.trajectoryStepCount - 1, name); +}, "~S"); +Clazz.defineMethod(c$, "setCurrentAtomSetNumber", +function(atomSetNumber){ +this.setAtomSetNumber(this.iSet + (this.isTrajectory ? this.trajectoryStepCount : 0), atomSetNumber); +}, "~N"); +Clazz.defineMethod(c$, "setAtomSetNumber", +function(index, atomSetNumber){ +this.atomSetNumbers[index] = atomSetNumber; +}, "~N,~N"); +Clazz.defineMethod(c$, "setAtomSetModelProperty", +function(key, value){ +this.setAtomSetModelPropertyForSet(key, value, this.iSet); +}, "~S,~S"); +Clazz.defineMethod(c$, "setAtomSetModelPropertyForSet", +function(key, value, atomSetIndex){ +var p = this.getAtomSetAuxiliaryInfoValue(atomSetIndex, "modelProperties"); +if (p == null) this.setModelInfoForSet("modelProperties", p = new java.util.Properties(), atomSetIndex); +p.put(key, value); +if (key.startsWith(".")) p.put(key.substring(1), value); +}, "~S,~S,~N"); +Clazz.defineMethod(c$, "setAtomProperties", +function(key, data, atomSetIndex, isGroup){ +if ((typeof(data)=='string') && !(data).endsWith("\n")) data = data + "\n"; +if (atomSetIndex < 0) atomSetIndex = this.iSet; +var p = this.getAtomSetAuxiliaryInfoValue(atomSetIndex, "atomProperties"); +if (p == null) this.setModelInfoForSet("atomProperties", p = new java.util.Hashtable(), atomSetIndex); +p.put(key, data); +}, "~S,~O,~N,~B"); +Clazz.defineMethod(c$, "setAtomSetPartialCharges", +function(auxKey){ +if (!this.atomSetAuxiliaryInfo[this.iSet].containsKey(auxKey)) { +return false; +}var atomData = this.getAtomSetAuxiliaryInfoValue(this.iSet, auxKey); +for (var i = atomData.size(); --i >= 0; ) { +this.atoms[i].partialCharge = atomData.get(i).floatValue(); +} +return true; +}, "~S"); +Clazz.defineMethod(c$, "getAtomSetAuxiliaryInfoValue", +function(index, key){ +return this.atomSetAuxiliaryInfo[index >= 0 ? index : this.iSet].get(key); +}, "~N,~S"); +Clazz.defineMethod(c$, "setCurrentModelInfo", +function(key, value){ +this.setModelInfoForSet(key, value, this.iSet); +}, "~S,~O"); +Clazz.defineMethod(c$, "setModelInfoForSet", +function(key, value, atomSetIndex){ +if (atomSetIndex < 0) return; +if (this.atomSetAuxiliaryInfo[atomSetIndex] == null) this.atomSetAuxiliaryInfo[atomSetIndex] = new java.util.Hashtable(); +if (value == null) this.atomSetAuxiliaryInfo[atomSetIndex].remove(key); + else this.atomSetAuxiliaryInfo[atomSetIndex].put(key, value); +}, "~S,~O,~N"); +Clazz.defineMethod(c$, "getAtomSetNumber", +function(atomSetIndex){ +return this.atomSetNumbers[atomSetIndex >= this.atomSetCount ? 0 : atomSetIndex]; +}, "~N"); +Clazz.defineMethod(c$, "getAtomSetName", +function(atomSetIndex){ +if (this.trajectoryNames != null && atomSetIndex < this.trajectoryNames.size()) return this.trajectoryNames.get(atomSetIndex); +if (atomSetIndex >= this.atomSetCount) atomSetIndex = this.atomSetCount - 1; +return this.getAtomSetAuxiliaryInfoValue(atomSetIndex, "name"); +}, "~N"); +Clazz.defineMethod(c$, "getAtomSetAuxiliaryInfo", +function(atomSetIndex){ +var i = (atomSetIndex >= this.atomSetCount ? this.atomSetCount - 1 : atomSetIndex); +return (i < 0 ? null : this.atomSetAuxiliaryInfo[i]); +}, "~N"); +Clazz.defineMethod(c$, "setAtomSetEnergy", +function(energyString, value){ +if (this.iSet < 0) return; +JU.Logger.info("Energy for model " + (this.iSet + 1) + " = " + energyString); +this.setCurrentModelInfo("EnergyString", energyString); +this.setCurrentModelInfo("Energy", Float.$valueOf(value)); +this.setAtomSetModelProperty("Energy", "" + value); +}, "~S,~N"); +Clazz.defineMethod(c$, "setAtomSetFrequency", +function(mode, pathKey, label, freq, units){ +this.setAtomSetModelProperty("FreqValue", freq); +freq += " " + (units == null ? "cm^-1" : units); +var name = (label == null ? "" : label + " ") + freq; +this.setAtomSetName(name); +this.setAtomSetModelProperty("Frequency", freq); +this.setAtomSetModelProperty("Mode", "" + mode); +this.setModelInfoForSet("vibrationalMode", Integer.$valueOf(mode), this.iSet); +if (label != null) this.setAtomSetModelProperty("FrequencyLabel", label); +this.setAtomSetModelProperty(".PATH", (pathKey == null ? "" : pathKey + J.adapter.smarter.SmarterJmolAdapter.PATH_SEPARATOR + "Frequencies") + "Frequencies"); +return name; +}, "~N,~S,~S,~S,~S"); +Clazz.defineMethod(c$, "getBondList", +function(){ +var info = new Array(this.bondCount); +for (var i = 0; i < this.bondCount; i++) { +info[i] = Clazz.newArray(-1, [this.atoms[this.bonds[i].atomIndex1].atomName, this.atoms[this.bonds[i].atomIndex2].atomName, "" + this.bonds[i].order]); +} +return info; +}); +Clazz.defineMethod(c$, "centralize", +function(){ +var pt = new JU.P3(); +for (var i = 0; i < this.atomSetCount; i++) { +var n = this.atomSetAtomCounts[i]; +var atom0 = this.atomSetAtomIndexes[i]; +pt.set(0, 0, 0); +for (var j = atom0 + n; --j >= atom0; ) pt.add(this.atoms[j]); + +pt.scale(1 / n); +for (var j = atom0 + n; --j >= atom0; ) this.atoms[j].sub(pt); + +} +}); +Clazz.defineMethod(c$, "mergeTrajectories", +function(a){ +if (!this.isTrajectory || !a.isTrajectory || this.vibrationSteps != null) return; +for (var i = 0; i < a.trajectoryStepCount; i++) this.trajectorySteps.add(this.trajectoryStepCount++, a.trajectorySteps.get(i)); + +this.setInfo("trajectorySteps", this.trajectorySteps); +this.setInfo("ignoreUnitCell", a.atomSetInfo.get("ignoreUnitCell")); +}, "J.adapter.smarter.AtomSetCollection"); +Clazz.defineMethod(c$, "removeAtomSet", +function(imodel){ +if (this.bsAtoms == null) this.bsAtoms = JU.BSUtil.newBitSet2(0, this.ac); +var i0 = this.atomSetAtomIndexes[imodel]; +var nAtoms = this.atomSetAtomCounts[imodel]; +var i1 = i0 + nAtoms; +this.bsAtoms.clearBits(i0, i1); +for (var i = i1; i < this.ac; i++) this.atoms[i].atomSetIndex--; + +for (var i = imodel + 1; i < this.atomSetCount; i++) { +this.atomSetAuxiliaryInfo[i - 1] = this.atomSetAuxiliaryInfo[i]; +this.atomSetAtomIndexes[i - 1] = this.atomSetAtomIndexes[i]; +this.atomSetBondCounts[i - 1] = this.atomSetBondCounts[i]; +this.atomSetAtomCounts[i - 1] = this.atomSetAtomCounts[i]; +this.atomSetNumbers[i - 1] = this.atomSetNumbers[i]; +} +for (var i = 0; i < this.bondCount; i++) this.bonds[i].atomSetIndex = this.atoms[this.bonds[i].atomIndex1].atomSetIndex; + +this.atomSetAuxiliaryInfo[--this.atomSetCount] = null; +var n = 0; +for (var i = 0; i < this.structureCount; i++) { +var s = this.structures[i]; +if (s.modelStartEnd[0] == imodel && s.modelStartEnd[1] == imodel) { +this.structures[i] = null; +n++; +}} +if (n > 0) { +var ss = new Array(this.structureCount - n); +for (var i = 0, pt = 0; i < this.structureCount; i++) if (this.structures[i] != null) ss[pt++] = this.structures[i]; + +this.structures = ss; +}}, "~N"); +Clazz.defineMethod(c$, "removeLastUnselectedAtoms", +function(){ +var n = this.ac; +var nremoved = 0; +var i0 = this.getLastAtomSetAtomIndex(); +var nnow = 0; +for (var i = i0; i < n; i++) { +if (!this.bsAtoms.get(i)) { +nremoved++; +this.ac--; +this.atoms[i] = null; +continue; +}if (nremoved > 0) { +this.atoms[this.atoms[i].index = i - nremoved] = this.atoms[i]; +this.atoms[i] = null; +}nnow++; +} +this.atomSetAtomCounts[this.iSet] = nnow; +if (nnow == 0) { +this.iSet--; +this.atomSetCount--; +} else { +this.bsAtoms.setBits(i0, i0 + nnow); +}}); +Clazz.defineMethod(c$, "checkNoEmptyModel", +function(){ +while (this.atomSetCount > 0 && this.atomSetAtomCounts[this.atomSetCount - 1] == 0) this.atomSetCount--; + +}); +Clazz.defineMethod(c$, "getBSAtoms", +function(n){ +if (this.bsAtoms == null) { +this.bsAtoms = new JU.BS(); +if (n != 0) this.bsAtoms.setBits(0, (n < 0 ? this.ac : n)); +}return this.bsAtoms; +}, "~N"); +Clazz.defineMethod(c$, "setBSAtomsForSet", +function(iSet){ +if (this.bsAtoms != null) { +if (iSet < 0) iSet = this.iSet; +var pt = this.atomSetAtomIndexes[iSet]; +if (this.bsAtoms.nextSetBit(pt) < 0) { +var n = this.atomSetAtomCounts[iSet]; +this.bsAtoms.setBits(pt, pt + n); +}}}, "~N"); +Clazz.defineMethod(c$, "fix2Stereo", +function(){ +this.getBSAtoms(-1); +for (var i = this.bondCount; --i >= 0; ) { +var b = this.bonds[i]; +if (this.atoms[b.atomIndex2].elementSymbol.equals("H") && b.order != 1025 && b.order != 1041 && this.atoms[b.atomIndex1].elementSymbol.equals("C")) { +this.bsAtoms.clear(b.atomIndex2); +} else if (this.atoms[b.atomIndex1].elementSymbol.equals("H") && this.atoms[b.atomIndex2].elementSymbol.equals("C")) { +this.bsAtoms.clear(b.atomIndex1); +}} +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/AtomSetCollectionReader.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/AtomSetCollectionReader.js new file mode 100755 index 000000000000..19771a96f821 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/AtomSetCollectionReader.js @@ -0,0 +1,1325 @@ +Clazz.declarePackage("J.adapter.smarter"); +Clazz.load(["javajs.api.GenericLineReader", "JU.SB", "JV.Viewer"], "J.adapter.smarter.AtomSetCollectionReader", ["JU.BS", "$.Lst", "$.M3", "$.P3", "$.PT", "$.Quat", "$.V3", "J.adapter.smarter.Atom", "$.AtomSetCollection", "J.api.Interface", "$.JmolAdapter", "JU.BSUtil", "$.Logger", "$.SimpleUnitCell", "JV.FileManager", "$.JC"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.isBinary = false; +this.debugging = false; +this.requiresBSFilter = false; +this.primitiveToCrystal = null; +this.asc = null; +this.reader = null; +this.binaryDoc = null; +this.readerName = null; +this.htParams = null; +this.trajectorySteps = null; +this.domains = null; +this.validation = null; +this.dssr = null; +this.isConcatenated = false; +this.addedData = null; +this.addedDataKey = null; +this.thisBiomolecule = null; +this.lstNCS = null; +this.floatifyJavaDouble = true; +this.line = null; +this.prevline = null; +this.next = null; +this.ptLine = 0; +this.checkNearAtoms = true; +this.latticeType = null; +this.latticeCells = null; +this.fillRange = null; +this.doProcessLines = false; +this.iHaveUnitCell = false; +this.iHaveSymmetryOperators = false; +this.continuing = true; +this.vwr = null; +this.doApplySymmetry = false; +this.ignoreFileSymmetryOperators = false; +this.isTrajectory = false; +this.applySymmetryToBonds = false; +this.doCheckUnitCell = false; +this.getHeader = false; +this.isSequential = false; +this.optimize2D = false; +this.noHydrogens = false; +this.noMinimize = false; +this.is2D = false; +this.isMolecular = false; +this.templateAtomCount = 0; +this.modelNumber = 0; +this.vibrationNumber = 0; +this.desiredVibrationNumber = -2147483648; +this.bsModels = null; +this.useFileModelNumbers = false; +this.havePartialChargeFilter = false; +this.calculationType = "?"; +this.sgName = null; +this.ignoreFileUnitCell = false; +this.ignoreFileSpaceGroupName = false; +this.unitCellParams = null; +this.desiredModelNumber = -2147483648; +this.symmetry = null; +this.out = null; +this.iHaveFractionalCoordinates = false; +this.doPackUnitCell = false; +this.ptSupercell = null; +this.mustFinalizeModelSet = false; +this.forcePacked = false; +this.packingRange = null; +this.cellSlop = 1.0E-4; +this.rotateHexCell = false; +this.isPrimitive = false; +this.modDim = 0; +this.lowPrecision = false; +this.highprecision0 = false; +this.loadNote = null; +this.doConvertToFractional = false; +this.fileCoordinatesAreFractional = false; +this.merging = false; +this.symmetryRange = 0; +this.firstLastStep = null; +this.lastModelNumber = 2147483647; +this.desiredSpaceGroupIndex = -1; +this.latticeScaling = NaN; +this.unitCellOffset = null; +this.unitCellOffsetFractional = false; +this.moreUnitCellInfo = null; +this.paramsLattice = null; +this.paramsCentroid = false; +this.paramsPacked = false; +this.fileScaling = null; +this.fileOffset = null; +this.fileOffsetFractional = null; +this.filePath = null; +this.fileName = null; +this.baseAtomIndex = 0; +this.baseBondIndex = 0; +this.stateScriptVersionInt = 2147483647; +this.isFinalized = false; +this.noPack = false; +this.isSUPERCELL = false; +this.precision = 0; +this.haveModel = false; +this.previousSpaceGroup = null; +this.previousUnitCell = null; +this.nMatrixElements = 0; +this.ucItems = null; +this.matUnitCellOrientation = null; +this.bsFilter = null; +this.filter = null; +this.filterCased = null; +this.haveAtomFilter = false; +this.filterAltLoc = false; +this.filterGroup3 = false; +this.filterChain = false; +this.filterAtomName = false; +this.filterAtomType = false; +this.filterAtomTypeStr = null; +this.filterAtomNameTerminator = ";"; +this.filterElement = false; +this.filterHetero = false; +this.filterAllHetero = false; +this.filterEveryNth = false; +this.filterSymop = null; +this.filterN = 0; +this.nFiltered = 0; +this.doSetOrientation = false; +this.doCentralize = false; +this.addVibrations = false; +this.useAltNames = false; +this.ignoreStructure = false; +this.isDSSP1 = false; +this.allowPDBFilter = false; +this.doReadMolecularOrbitals = false; +this.reverseModels = false; +this.nameRequired = null; +this.doCentroidUnitCell = false; +this.centroidPacked = false; +this.strSupercell = null; +this.allow_a_len_1 = false; +this.slabXY = false; +this.polymerX = false; +this.fixUnitCell = false; +this.filteredPrecision = false; +this.filter1 = null; +this.filter2 = null; +this.filter1Cased = null; +this.filter2Cased = null; +this.matRot = null; +this.ms = null; +this.vibsFractional = false; +this.previousScript = null; +this.siteScript = null; +Clazz.instantialize(this, arguments);}, J.adapter.smarter, "AtomSetCollectionReader", null, javajs.api.GenericLineReader); +Clazz.prepareFields (c$, function(){ +this.next = Clazz.newIntArray (1, 0); +this.highprecision0 = JV.Viewer.isHighPrecision; +this.loadNote = new JU.SB(); +}); +Clazz.defineMethod(c$, "getPackingRangeValue", +function(def){ +return (this.packingRange != null ? this.packingRange.floatValue() : def != 0 ? def : 0.02); +}, "~N"); +Clazz.defineMethod(c$, "setup", +function(fullPath, htParams, readerOrDocument){ +this.setupASCR(fullPath, htParams, readerOrDocument); +}, "~S,java.util.Map,~O"); +Clazz.defineMethod(c$, "setupASCR", +function(fullPath, htParams, readerOrDocument){ +if (fullPath == null) return; +this.debugging = JU.Logger.debugging; +this.htParams = htParams; +this.filePath = JV.FileManager.stripTypePrefix("" + htParams.get("fullPathName")); +var i = this.filePath.lastIndexOf('/'); +this.fileName = this.filePath.substring(i + 1); +if (Clazz.instanceOf(readerOrDocument,"java.io.BufferedReader")) this.reader = readerOrDocument; + else if (Clazz.instanceOf(readerOrDocument,"javajs.api.GenericBinaryDocument")) this.binaryDoc = readerOrDocument; +}, "~S,java.util.Map,~O"); +Clazz.defineMethod(c$, "readData", +function(){ +this.initialize(); +this.asc = new J.adapter.smarter.AtomSetCollection(this.readerName, this, null, null); +try { +this.initializeReader(); +if (this.binaryDoc == null) { +if (this.line == null && this.continuing) this.rd(); +while (this.line != null && this.continuing) if (this.checkLine()) this.rd(); + +} else { +this.binaryDoc.setOutputChannel(this.out); +this.processBinaryDocument(); +}this.finalizeSubclassReader(); +if (!this.isFinalized) this.finalizeReaderASCR(); +} catch (e) { +JU.Logger.info("Reader error: " + e); +e.printStackTrace(); +this.setError(e); +} +if (this.reader != null) this.reader.close(); +if (this.binaryDoc != null) this.binaryDoc.close(); +return this.finish(); +}); +Clazz.defineMethod(c$, "fixBaseIndices", +function(){ +try { +var ii = this.htParams.get("baseModelIndex"); +if (ii == null) return; +var baseModelIndex = ii.intValue(); +this.baseAtomIndex += this.asc.ac; +this.baseBondIndex += this.asc.bondCount; +baseModelIndex += this.asc.atomSetCount; +this.htParams.put("baseAtomIndex", Integer.$valueOf(this.baseAtomIndex)); +this.htParams.put("baseBondIndex", Integer.$valueOf(this.baseBondIndex)); +this.htParams.put("baseModelIndex", Integer.$valueOf(baseModelIndex)); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +}); +Clazz.defineMethod(c$, "readDataObject", +function(node){ +this.initialize(); +this.asc = new J.adapter.smarter.AtomSetCollection(this.readerName, this, null, null); +this.initializeReader(); +this.processDOM(node); +return this.finish(); +}, "~O"); +Clazz.defineMethod(c$, "processDOM", +function(DOMNode){ +}, "~O"); +Clazz.defineMethod(c$, "processBinaryDocument", +function(){ +}); +Clazz.defineMethod(c$, "initializeReader", +function(){ +}); +Clazz.defineMethod(c$, "checkLine", +function(){ +return true; +}); +Clazz.defineMethod(c$, "checkLastModel", +function(){ +if (this.isLastModel(this.modelNumber) && this.doProcessLines) return (this.continuing = this.doProcessLines = false); +this.doProcessLines = false; +return true; +}); +Clazz.defineMethod(c$, "isLastModel", +function(modelNumber){ +return (this.desiredModelNumber > 0 || modelNumber >= this.lastModelNumber); +}, "~N"); +Clazz.defineMethod(c$, "appendLoadNote", +function(info){ +if (info == null) { +this.loadNote = new JU.SB(); +return; +}this.loadNote.append(info).append("\n"); +JU.Logger.info(info); +}, "~S"); +Clazz.defineMethod(c$, "initializeTrajectoryFile", +function(){ +this.asc.addAtom( new J.adapter.smarter.Atom()); +this.trajectorySteps = this.htParams.get("trajectorySteps"); +if (this.trajectorySteps == null) this.htParams.put("trajectorySteps", this.trajectorySteps = new JU.Lst()); +}); +Clazz.defineMethod(c$, "finalizeSubclassReader", +function(){ +}); +Clazz.defineMethod(c$, "finalizeReaderASCR", +function(){ +this.isFinalized = true; +if (this.asc.atomSetCount > 0) { +if (this.asc.atomSetCount == 1) { +this.asc.setCurrentModelInfo("dbName", this.htParams.get("dbName")); +this.asc.setCurrentModelInfo("auxFiles", this.htParams.get("auxFiles")); +}this.applySymmetryAndSetTrajectory(); +this.asc.finalizeStructures(); +if (this.doCentralize) this.asc.centralize(); +if (this.fillRange != null) this.asc.setInfo("boundbox", this.fillRange); +var info = this.asc.getAtomSetAuxiliaryInfo(0); +if (info != null) { +if (this.domains != null) { +this.asc.setGlobalBoolean(5); +var s = (this.domains).getMapKeys(2, true); +var pt = s.indexOf("{ ", 2); +if (pt >= 0) s = s.substring(pt + 2); +pt = s.indexOf("_metadata"); +if (pt < 0) pt = s.indexOf("metadata"); +if (pt >= 0) s = s.substring(0, pt); +s = JU.PT.rep(JU.PT.replaceAllCharacters(s, "{}", "").trim(), "\n", "\n ") + "\n\nUse SHOW DOMAINS for details."; +this.appendLoadNote("\nDomains loaded:\n " + s); +for (var i = this.asc.atomSetCount; --i >= 0; ) { +info = this.asc.getAtomSetAuxiliaryInfo(i); +info.put("domains", this.domains); +} +}if (this.validation != null) { +for (var i = this.asc.atomSetCount; --i >= 0; ) { +info = this.asc.getAtomSetAuxiliaryInfo(i); +info.put("validation", this.validation); +} +}if (this.dssr != null) { +info.put("dssrJSON", Boolean.TRUE); +for (var i = this.asc.atomSetCount; --i >= 0; ) { +info = this.asc.getAtomSetAuxiliaryInfo(i); +info.put("dssr", this.dssr); +} +}}}if (!this.floatifyJavaDouble) this.asc.setInfo("highPrecision", Boolean.TRUE); +this.setLoadNote(); +}); +Clazz.defineMethod(c$, "setLoadNote", +function(){ +var s = this.loadNote.toString(); +if (this.loadNote.length() > 0) this.asc.setInfo("modelLoadNote", s); +return s; +}); +Clazz.defineMethod(c$, "setIsPDB", +function(){ +this.asc.setGlobalBoolean(4); +if (this.htParams.get("pdbNoHydrogens") != null) this.asc.setInfo("pdbNoHydrogens", this.htParams.get("pdbNoHydrogens")); +if (this.checkFilterKey("ADDHYDROGENS")) this.asc.setInfo("pdbAddHydrogens", Boolean.TRUE); +}); +Clazz.defineMethod(c$, "setModelPDB", +function(isPDB){ +if (isPDB) this.asc.setGlobalBoolean(4); + else this.asc.clearGlobalBoolean(4); +this.asc.setCurrentModelInfo(JV.JC.getBoolName(4), isPDB ? Boolean.TRUE : null); +}, "~B"); +Clazz.defineMethod(c$, "finish", +function(){ +if (false != this.highprecision0) this.vwr.setBooleanPropertyTok("doubleprecision", 603979831, this.highprecision0); +var s = this.htParams.get("loadState"); +this.asc.setInfo("loadState", s == null ? "" : s); +s = this.htParams.get("smilesString"); +if (s != null) this.asc.setInfo("smilesString", s); +if (!this.htParams.containsKey("templateAtomCount")) this.htParams.put("templateAtomCount", Integer.$valueOf(this.asc.ac)); +if (this.bsFilter != null) { +this.htParams.put("filteredAtomCount", Integer.$valueOf(JU.BSUtil.cardinalityOf(this.bsFilter))); +this.htParams.put("bsFilter", this.bsFilter); +}if (!this.calculationType.equals("?")) this.asc.setInfo("calculationType", this.calculationType); +var name = this.asc.fileTypeName; +var fileType = name; +if (fileType.indexOf("(") >= 0) fileType = fileType.substring(0, fileType.indexOf("(")); +for (var i = this.asc.atomSetCount; --i >= 0; ) { +this.asc.setModelInfoForSet("fileName", this.filePath, i); +this.asc.setModelInfoForSet("fileType", fileType, i); +} +this.asc.freeze(this.reverseModels); +if (this.asc.errorMessage != null) return this.asc.errorMessage + "\nfor file " + this.filePath + "\ntype " + name; +if (!this.merging && (this.asc.bsAtoms == null ? this.asc.ac == 0 : this.asc.bsAtoms.nextSetBit(0) < 0) && fileType.indexOf("DataOnly") < 0 && this.asc.atomSetInfo.get("dataOnly") == null) return "No atoms found\nfor file " + this.filePath + "\ntype " + name; +this.fixBaseIndices(); +return this.asc; +}); +Clazz.defineMethod(c$, "setError", +function(e){ +var s = e.getMessage(); +if (this.line == null) this.asc.errorMessage = "Error reading file at end of file \n" + s; + else this.asc.errorMessage = "Error reading file at line " + this.ptLine + ":\n" + this.line + "\n" + s; +e.printStackTrace(); +}, "Throwable"); +Clazz.defineMethod(c$, "initialize", +function(){ +if (this.htParams.containsKey("baseAtomIndex")) this.baseAtomIndex = (this.htParams.get("baseAtomIndex")).intValue(); +if (this.htParams.containsKey("baseBondIndex")) this.baseBondIndex = (this.htParams.get("baseBondIndex")).intValue(); +this.initializeSymmetry(); +this.vwr = this.htParams.remove("vwr"); +if (this.htParams.containsKey("stateScriptVersionInt")) this.stateScriptVersionInt = (this.htParams.get("stateScriptVersionInt")).intValue(); +this.packingRange = this.htParams.get("packingRange"); +var isHighPrecision = (this.htParams.get("highPrecision") != null); +if (this.packingRange == null && isHighPrecision) { +this.floatifyJavaDouble = false; +this.packingRange = Float.$valueOf(1.0E-4); +}this.merging = this.htParams.containsKey("merging"); +this.getHeader = this.htParams.containsKey("getHeader"); +this.isSequential = this.htParams.containsKey("isSequential"); +this.readerName = this.htParams.get("readerName"); +if (this.htParams.containsKey("outputChannel")) this.out = this.htParams.get("outputChannel"); +if (this.htParams.containsKey("vibrationNumber")) this.desiredVibrationNumber = (this.htParams.get("vibrationNumber")).intValue(); + else if (this.htParams.containsKey("modelNumber")) this.desiredModelNumber = (this.htParams.get("modelNumber")).intValue(); +this.applySymmetryToBonds = this.htParams.containsKey("applySymmetryToBonds"); +this.bsFilter = (this.requiresBSFilter ? this.htParams.get("bsFilter") : null); +this.setFilter(null); +this.fillRange = this.htParams.get("fillRange"); +this.paramsLattice = this.htParams.get("lattice"); +var o = this.htParams.get("supercell"); +this.noPack = this.checkFilterKey("NOPACK"); +if (this.strSupercell != null && !this.noPack) { +this.forcePacked = true; +}if (Clazz.instanceOf(o,"JU.P3")) { +var s = this.ptSupercell = o; +if (s.length() != 1) { +this.strSupercell = (Clazz.floatToInt(s.x)) + "a," + (Clazz.floatToInt(s.y)) + "b," + (Clazz.floatToInt(s.z)) + "c"; +this.isSUPERCELL = true; +}} else if ((typeof(o)=='string')) { +this.strSupercell = o; +this.isSUPERCELL = true; +}var ptFile = (this.htParams.containsKey("ptFile") ? (this.htParams.get("ptFile")).intValue() : -1); +this.isTrajectory = this.htParams.containsKey("isTrajectory"); +if (ptFile > 0 && this.htParams.containsKey("firstLastSteps")) { +var val = (this.htParams.get("firstLastSteps")).get(ptFile - 1); +if (Clazz.instanceOf(val,"JU.BS")) { +this.bsModels = val; +} else { +this.firstLastStep = val; +}} else if (this.htParams.containsKey("firstLastStep")) { +this.firstLastStep = this.htParams.get("firstLastStep"); +} else if (this.htParams.containsKey("bsModels")) { +this.bsModels = this.htParams.get("bsModels"); +}this.useFileModelNumbers = this.htParams.containsKey("useFileModelNumbers") || this.checkFilterKey("USEFILEMODELNUMBERS"); +if (this.htParams.containsKey("templateAtomCount")) this.templateAtomCount = (this.htParams.get("templateAtomCount")).intValue(); +if (this.bsModels != null || this.firstLastStep != null) this.desiredModelNumber = -2147483648; +if (this.bsModels == null && this.firstLastStep != null) { +if (this.firstLastStep[0] < 0) this.firstLastStep[0] = 0; +if (this.firstLastStep[2] == 0 || this.firstLastStep[1] < this.firstLastStep[0]) this.firstLastStep[1] = -1; +if (this.firstLastStep[2] < 1) this.firstLastStep[2] = 1; +this.bsModels = JU.BSUtil.newAndSetBit(this.firstLastStep[0]); +if (this.firstLastStep[1] > this.firstLastStep[0]) { +for (var i = this.firstLastStep[0]; i <= this.firstLastStep[1]; i += this.firstLastStep[2]) this.bsModels.set(i); + +}}if (this.bsModels != null && (this.firstLastStep == null || this.firstLastStep[1] != -1)) this.lastModelNumber = this.bsModels.length(); +this.symmetryRange = (this.htParams.containsKey("symmetryRange") ? (this.htParams.get("symmetryRange")).floatValue() : 0); +this.paramsCentroid = this.htParams.containsKey("centroid"); +this.paramsPacked = this.htParams.containsKey("packed"); +this.initializeSymmetryOptions(); +if (this.htParams.containsKey("spaceGroupIndex")) { +this.desiredSpaceGroupIndex = (this.htParams.get("spaceGroupIndex")).intValue(); +if (this.desiredSpaceGroupIndex == -2) this.sgName = this.htParams.get("spaceGroupName"); +this.ignoreFileSpaceGroupName = (this.desiredSpaceGroupIndex == -2 || this.desiredSpaceGroupIndex >= 0); +this.ignoreFileSymmetryOperators = (this.desiredSpaceGroupIndex != -1); +}if (this.htParams.containsKey("unitCellOffset")) { +this.fileScaling = JU.P3.new3(1, 1, 1); +this.fileOffset = this.htParams.get("unitCellOffset"); +this.fileOffsetFractional = JU.P3.newP(this.fileOffset); +this.unitCellOffsetFractional = this.htParams.containsKey("unitCellOffsetFractional"); +}if (this.htParams.containsKey("unitcell")) { +var fParams = this.htParams.get("unitcell"); +if (this.merging) this.setFractionalCoordinates(true); +if (fParams.length == 9) { +this.addExplicitLatticeVector(0, fParams, 0); +this.addExplicitLatticeVector(1, fParams, 3); +this.addExplicitLatticeVector(2, fParams, 6); +} else { +this.setUnitCell(fParams[0], fParams[1], fParams[2], fParams[3], fParams[4], fParams[5]); +}this.ignoreFileUnitCell = this.iHaveUnitCell; +if (this.merging && !this.iHaveUnitCell) this.setFractionalCoordinates(false); +}this.domains = this.htParams.get("domains"); +this.validation = this.htParams.get("validation"); +this.dssr = this.htParams.get("dssr"); +this.isConcatenated = this.htParams.containsKey("concatenate"); +}); +Clazz.defineMethod(c$, "parsePrecision", +function(s){ +if (!this.filteredPrecision) { +var pt = s.indexOf('.') + 1; +if (pt >= 0) { +var n = s.indexOf('('); +if (n < 0) { +this.precision = Math.max(this.precision, s.length - pt); +} else { +if (this.precision == 0) this.precision = n; +this.precision = Math.min(this.precision, n - 1 - pt); +}}}return this.parseFloatStr(s); +}, "~S"); +Clazz.defineMethod(c$, "setLowPrecision", +function(){ +this.lowPrecision = true; +this.cellSlop = 1.0E-4; +if (this.packingRange == null) this.packingRange = Double.$valueOf(1.0E-4); +}); +Clazz.defineMethod(c$, "setPrecision", +function(){ +var isHigh; +if (this.lowPrecision) { +isHigh = false; +this.precision = 4; +} else { +if (this.precision > 1000) { +this.precision -= 1000; +} else { +this.precision = Math.min(12, Math.max(4, this.precision)); +}isHigh = (this.precision >= 7); +if (isHigh) { +this.vwr.setBooleanProperty("doubleprecision", true); +if (JV.Viewer.isHighPrecision) { +this.cellSlop = 1.0E-12; +if (!this.paramsPacked) this.packingRange = Double.$valueOf(this.cellSlop); +this.asc.setInfo("highPrecision", Boolean.TRUE); +} else { +isHigh = false; +this.precision = 6; +this.appendLoadNote("Structure read has high precision but this version of Jmol uses float precision.\nUse JmolD.jar or JavaScript for full precision."); +}}}if (!isHigh) { +if (this.precision < 10) { +this.cellSlop = Math.pow(10, -this.precision); +}}this.symmetry.setPrecision(this.cellSlop); +this.unitCellParams[26] = this.cellSlop; +if (this.fileCoordinatesAreFractional) { +for (var i = this.asc.ac, n = this.asc.getLastAtomSetAtomIndex(); --i >= n; ) { +this.symmetry.twelfthify(this.asc.atoms[i]); +} +}this.appendLoadNote("Precision set to " + this.precision + "; packing set to " + (this.packingRange == null ? 0.02 : this.packingRange.floatValue())); +}); +Clazz.defineMethod(c$, "initializeSymmetryOptions", +function(){ +this.latticeCells = Clazz.newIntArray (4, 0); +this.doApplySymmetry = false; +var pt = this.paramsLattice; +if (pt == null || pt.length() == 0) { +if (!this.forcePacked && this.strSupercell == null) return; +pt = JU.P3.new3(1, 1, 1); +}this.latticeCells[0] = Clazz.floatToInt(pt.x); +this.latticeCells[1] = Clazz.floatToInt(pt.y); +this.latticeCells[2] = Clazz.floatToInt(pt.z); +if (Clazz.instanceOf(pt,"JU.T4")) this.latticeCells[3] = Clazz.floatToInt((pt).w); +this.doCentroidUnitCell = this.paramsCentroid; +if (this.doCentroidUnitCell && (this.latticeCells[2] == -1 || this.latticeCells[2] == 0)) this.latticeCells[2] = 1; +var isPacked = this.forcePacked || this.paramsPacked; +this.centroidPacked = this.doCentroidUnitCell && isPacked; +this.doPackUnitCell = !this.doCentroidUnitCell && (isPacked || this.latticeCells[2] < 0); +this.doApplySymmetry = (this.latticeCells[0] > 0 && this.latticeCells[1] > 0); +if (!this.doApplySymmetry) this.latticeCells = Clazz.newIntArray (3, 0); +}); +Clazz.defineMethod(c$, "doGetModel", +function(modelNumber, title){ +if (title != null && this.nameRequired != null && this.nameRequired.length > 0 && title.toUpperCase().indexOf(this.nameRequired) < 0) return false; +var isOK = (this.bsModels == null ? this.desiredModelNumber < 1 || modelNumber == this.desiredModelNumber : modelNumber > this.lastModelNumber ? false : modelNumber > 0 && this.bsModels.get(modelNumber - 1) || this.haveModel && this.firstLastStep != null && this.firstLastStep[1] < 0 && (this.firstLastStep[2] < 2 || (modelNumber - 1 - this.firstLastStep[0]) % this.firstLastStep[2] == 0)); +if (isOK && this.desiredModelNumber == 0) this.discardPreviousAtoms(); +this.haveModel = new Boolean (this.haveModel | isOK).valueOf(); +if (isOK) this.doProcessLines = true; +return isOK; +}, "~N,~S"); +Clazz.defineMethod(c$, "discardPreviousAtoms", +function(){ +this.asc.discardPreviousAtoms(); +}); +Clazz.defineMethod(c$, "initializeSymmetry", +function(){ +this.previousSpaceGroup = this.sgName; +this.previousUnitCell = this.unitCellParams; +this.iHaveUnitCell = this.ignoreFileUnitCell; +if (!this.ignoreFileUnitCell) { +this.unitCellParams = Clazz.newFloatArray (27, 0); +for (var i = 27; --i >= 0; ) this.unitCellParams[i] = NaN; + +this.unitCellParams[25] = this.latticeScaling; +this.unitCellParams[26] = this.cellSlop; +this.symmetry = null; +}if (!this.ignoreFileSpaceGroupName) this.sgName = "unspecified!"; +this.doCheckUnitCell = false; +}); +Clazz.defineMethod(c$, "newAtomSet", +function(name){ +if (this.asc.iSet >= 0) { +this.asc.newAtomSet(); +this.asc.setCollectionName(" "); +} else { +this.asc.setCollectionName(name); +}this.asc.setModelInfoForSet("name", name, Math.max(0, this.asc.iSet)); +this.asc.setAtomSetName(name); +}, "~S"); +Clazz.defineMethod(c$, "cloneLastAtomSet", +function(ac, pts){ +var lastAtomCount = this.asc.getLastAtomSetAtomCount(); +this.asc.cloneLastAtomSetFromPoints(ac, pts); +if (this.asc.haveUnitCell) { +this.iHaveUnitCell = true; +this.doCheckUnitCell = true; +this.sgName = this.previousSpaceGroup; +this.unitCellParams = this.previousUnitCell; +}return lastAtomCount; +}, "~N,~A"); +Clazz.defineMethod(c$, "setSpaceGroupName", +function(name){ +if (this.ignoreFileSpaceGroupName || name == null) return; +var s = name.trim(); +if (s.length == 0 || s.equals("HM:") || s.equals(this.sgName)) return; +if (!s.equals("P1")) JU.Logger.info("Setting space group name to " + s); +this.sgName = s; +}, "~S"); +Clazz.defineMethod(c$, "setSymmetryOperator", +function(xyz){ +if (this.ignoreFileSymmetryOperators) return -1; +var isym = this.asc.getXSymmetry().addSpaceGroupOperation(xyz, true); +if (isym < 0) JU.Logger.warn("Skippings symmetry operation " + xyz); +this.iHaveSymmetryOperators = true; +return isym; +}, "~S"); +Clazz.defineMethod(c$, "initializeCartesianToFractional", +function(){ +for (var i = 0; i < 16; i++) if (!Float.isNaN(this.unitCellParams[6 + i])) return; + +for (var i = 0; i < 16; i++) this.unitCellParams[6 + i] = ((i % 5 == 0 ? 1 : 0)); + +this.nMatrixElements = 0; +}); +Clazz.defineMethod(c$, "clearUnitCell", +function(){ +if (this.ignoreFileUnitCell) return; +for (var i = 6; i < 22; i++) this.unitCellParams[i] = NaN; + +this.checkUnitCell(6); +}); +Clazz.defineMethod(c$, "setUnitCellItem", +function(i, x){ +if (this.ignoreFileUnitCell) return; +if (i == 0 && x == 1 && !this.allow_a_len_1 || i == 3 && x == 0) { +if (this.ucItems == null) this.ucItems = Clazz.newFloatArray (6, 0); +this.ucItems[i] = x; +return; +}if (this.ucItems != null && i < 6) this.ucItems[i] = x; +if (!Float.isNaN(x) && i >= 6 && Float.isNaN(this.unitCellParams[6])) this.initializeCartesianToFractional(); +this.unitCellParams[i] = x; +if (this.debugging) { +JU.Logger.debug("setunitcellitem " + i + " " + x); +}if (i < 6 || Float.isNaN(x)) this.iHaveUnitCell = this.checkUnitCell(6); + else if (++this.nMatrixElements == 12) this.iHaveUnitCell = this.checkUnitCell(22); +}, "~N,~N"); +Clazz.defineMethod(c$, "setUnitCell", +function(a, b, c, alpha, beta, gamma){ +if (this.ignoreFileUnitCell) return; +this.clearUnitCell(); +this.unitCellParams[0] = a; +this.unitCellParams[1] = b; +this.unitCellParams[2] = c; +if (alpha != 0) this.unitCellParams[3] = alpha; +if (beta != 0) this.unitCellParams[4] = beta; +if (gamma != 0) this.unitCellParams[5] = gamma; +this.iHaveUnitCell = this.checkUnitCell(6); +}, "~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "addExplicitLatticeVector", +function(i, xyz, i0){ +if (this.ignoreFileUnitCell) return; +if (i == 0) for (var j = 0; j < 6; j++) this.unitCellParams[j] = 0; + +i = 6 + i * 3; +this.unitCellParams[i++] = xyz[i0++]; +this.unitCellParams[i++] = xyz[i0++]; +this.unitCellParams[i] = xyz[i0]; +if (Float.isNaN(this.unitCellParams[0])) { +for (i = 0; i < 6; i++) this.unitCellParams[i] = -1; + +}this.iHaveUnitCell = this.checkUnitCell(15); +if (this.iHaveUnitCell) { +if (this.slabXY || this.polymerX) this.unitCellParams[2] = -1; +if (this.polymerX) this.unitCellParams[1] = -1; +}}, "~N,~A,~N"); +Clazz.defineMethod(c$, "checkUnitCell", +function(n){ +for (var i = 0; i < n; i++) if (Float.isNaN(this.unitCellParams[i])) return false; + +this.fixFloatA(this.unitCellParams); +if (n == 22 && this.unitCellParams[0] == 1) { +if (this.unitCellParams[1] == 1 && this.unitCellParams[2] == 1 && this.unitCellParams[6] == 1 && this.unitCellParams[11] == 1 && this.unitCellParams[16] == 1) { +return false; +}}if (n == 6 && Float.isNaN(this.unitCellParams[6])) { +if (this.slabXY && this.unitCellParams[2] > 0) { +JU.SimpleUnitCell.addVectors(this.unitCellParams); +this.unitCellParams[2] = -1; +} else if (this.polymerX && this.unitCellParams[1] > 0) { +JU.SimpleUnitCell.addVectors(this.unitCellParams); +this.unitCellParams[1] = this.unitCellParams[2] = -1; +}}if (this.doApplySymmetry) { +this.getSymmetry(); +this.doConvertToFractional = !this.fileCoordinatesAreFractional; +}return true; +}, "~N"); +Clazz.defineMethod(c$, "getSymmetry", +function(){ +if (!this.iHaveUnitCell) return null; +if (this.symmetry == null) { +(this.symmetry = this.asc.newFileSymmetry()).setUnitCellFromParams(this.unitCellParams, false, this.cellSlop); +this.checkUnitCellOffset(); +}if (this.symmetry == null) this.iHaveUnitCell = false; + else this.symmetry.setSpaceGroupName(this.sgName); +return this.symmetry; +}); +Clazz.defineMethod(c$, "checkUnitCellOffset", +function(){ +if (this.fileOffsetFractional == null || this.symmetry == null) return; +this.fileOffset.setT(this.fileOffsetFractional); +if (this.unitCellOffsetFractional != this.fileCoordinatesAreFractional) { +if (this.unitCellOffsetFractional) this.symmetry.toCartesian(this.fileOffset, false); + else this.symmetry.toFractional(this.fileOffset, false); +}}); +Clazz.defineMethod(c$, "fractionalizeCoordinates", +function(toFrac){ +if (this.getSymmetry() == null) return; +var a = this.asc.atoms; +if (toFrac) for (var i = this.asc.ac; --i >= 0; ) this.symmetry.toFractional(a[i], false); + + else for (var i = this.asc.ac; --i >= 0; ) this.symmetry.toCartesian(a[i], false); + +this.setFractionalCoordinates(toFrac); +}, "~B"); +Clazz.defineMethod(c$, "setFractionalCoordinates", +function(TF){ +this.iHaveFractionalCoordinates = this.fileCoordinatesAreFractional = TF; +this.checkUnitCellOffset(); +}, "~B"); +Clazz.defineMethod(c$, "setFilterAtomTypeStr", +function(s){ +this.filterAtomTypeStr = s; +this.filterAtomNameTerminator = "\0"; +}, "~S"); +Clazz.defineMethod(c$, "setFilter", +function(filter0){ +if (filter0 == null) { +filter0 = this.htParams.get("filter"); +} else { +this.bsFilter = null; +this.filterCased = null; +}if (this.filterCased == null) this.filterCased = (filter0 == null ? null : filter0 + ";"); +if (filter0 != null) filter0 = filter0.toUpperCase(); +this.filter = filter0; +this.doSetOrientation = !this.checkFilterKey("NOORIENT"); +this.doCentralize = (!this.checkFilterKey("NOCENTER") && this.checkFilterKey("CENTER")); +this.addVibrations = !this.checkFilterKey("NOVIB"); +this.ignoreStructure = this.checkFilterKey("DSSP"); +this.isDSSP1 = this.checkFilterKey("DSSP1"); +this.doReadMolecularOrbitals = !this.checkFilterKey("NOMO"); +this.useAltNames = this.checkFilterKey("ALTNAME"); +this.reverseModels = this.checkFilterKey("REVERSEMODELS"); +this.allow_a_len_1 = this.checkFilterKey("TOPOS"); +this.slabXY = this.checkFilterKey("SLABXY"); +this.polymerX = !this.slabXY && this.checkFilterKey("POLYMERX"); +this.noHydrogens = this.checkFilterKey("NOH"); +this.noMinimize = this.checkFilterKey("NOMIN"); +this.optimize2D = this.checkFilterKey("2D") && !this.noHydrogens && !this.noMinimize; +if (this.filter == null) return; +this.fixUnitCell = this.checkFilterKey("FIXUNITCELL"); +if (this.checkFilterKey("LOWPRECISION")) { +this.setLowPrecision(); +}if (this.checkFilterKey("HETATM")) { +this.filterHetero = true; +this.filter = JU.PT.rep(this.filter, "HETATM", "HETATM-Y"); +this.filterCased = JU.PT.rep(this.filterCased, "HETATM", "HETATM-Y"); +}if (this.checkFilterKey("ATOM")) { +this.filterHetero = true; +this.filter = JU.PT.rep(this.filter, "ATOM", "HETATM-N"); +this.filterCased = JU.PT.rep(this.filterCased, "ATOM", "HETATM-N"); +}if (this.checkFilterKey("CELL=")) this.strSupercell = this.filter.substring(this.filter.indexOf("CELL=") + 5).toLowerCase(); +this.nameRequired = JU.PT.getQuotedAttribute(this.filter, "NAME"); +if (this.nameRequired != null) { +if (this.nameRequired.startsWith("'")) this.nameRequired = JU.PT.split(this.nameRequired, "'")[1]; + else if (this.nameRequired.startsWith("\"")) this.nameRequired = JU.PT.split(this.nameRequired, "\"")[1]; +this.filter = JU.PT.rep(this.filter, this.nameRequired, ""); +filter0 = this.filter = JU.PT.rep(this.filter, "NAME=", ""); +}this.filterAtomName = this.checkFilterKey("*.") || this.checkFilterKey("!."); +if (this.filter.startsWith("_") || this.filter.startsWith("!_") || this.filter.indexOf(";_") >= 0) this.filterElement = this.checkFilterKey("_"); +this.filterGroup3 = this.checkFilterKey("["); +this.filterChain = this.checkFilterKey(":"); +this.filterAltLoc = this.checkFilterKey("%"); +this.filterEveryNth = this.checkFilterKey("/="); +this.filterAllHetero = this.checkFilterKey("ALLHET"); +if (this.filterEveryNth) this.filterN = this.parseIntAt(this.filter, this.filter.indexOf("/=") + 2); + else if (this.filter.startsWith("=") || this.filter.indexOf(";=") >= 0) this.filterAtomType = this.checkFilterKey("="); +if (this.filterN == -2147483648) this.filterEveryNth = false; +this.haveAtomFilter = this.filterAtomName || this.filterAtomType || this.filterElement || this.filterGroup3 || this.filterChain || this.filterAltLoc || this.filterHetero || this.filterEveryNth || this.checkFilterKey("/="); +if (this.bsFilter == null) { +this.bsFilter = new JU.BS(); +this.htParams.put("bsFilter", this.bsFilter); +this.filter = (";" + this.filter + ";").$replace(',', ';'); +var p = this.getFilter("PRECISION="); +if (p != null) { +var prec = JU.PT.parseInt(p); +if (prec > 0 && prec <= 16) { +this.precision = 1000 + prec; +this.filteredPrecision = true; +}}var s = this.getFilter("LATTICESCALING="); +if (s != null && this.unitCellParams.length > 25) this.unitCellParams[25] = this.latticeScaling = this.parseFloatStr(s); +s = this.getFilter("SYMOP="); +if (s != null) this.filterSymop = " " + s + " "; +JU.Logger.info("filtering with " + this.filter); +if (this.haveAtomFilter) { +var ipt; +this.filter1Cased = this.filterCased; +this.filter2Cased = ""; +if ((ipt = this.filter.indexOf("|")) >= 0) { +this.filter1Cased = this.filter.substring(0, ipt).trim() + ";"; +this.filter2Cased = ";" + this.filter.substring(ipt).trim(); +}this.filter1 = this.filter1Cased.toUpperCase(); +this.filter2 = (this.filter2Cased.length == 0 ? null : this.filter2Cased.toUpperCase()); +}}}, "~S"); +Clazz.defineMethod(c$, "getFilterWithCase", +function(key){ +var pt = (this.filterCased == null ? -1 : this.filterCased.toUpperCase().indexOf(key.toUpperCase())); +return (pt < 0 ? null : this.filterCased.substring(pt + key.length, this.filterCased.indexOf(";", pt))); +}, "~S"); +Clazz.defineMethod(c$, "getFilter", +function(key){ +var pt = (this.filter == null ? -1 : this.filter.indexOf(key)); +return (pt < 0 ? null : this.filter.substring(pt + key.length, this.filter.indexOf(";", pt))); +}, "~S"); +Clazz.defineMethod(c$, "checkFilterKey", +function(key){ +return (this.filter != null && this.filter.indexOf(key) >= 0); +}, "~S"); +Clazz.defineMethod(c$, "checkAndRemoveFilterKey", +function(key){ +if (!this.checkFilterKey(key)) return false; +this.filter = JU.PT.rep(this.filter, key, ""); +if (this.filter.length < 3) this.filter = null; +return true; +}, "~S"); +Clazz.defineMethod(c$, "filterAtom", +function(atom, iAtom){ +if (!this.haveAtomFilter) return true; +var isOK = this.checkFilter(atom, this.filter1, this.filter1Cased); +if (this.filter2 != null) isOK = new Boolean (isOK | this.checkFilter(atom, this.filter2, this.filter2Cased)).valueOf(); +if (isOK && this.filterEveryNth && (!atom.isHetero || !this.filterAllHetero)) isOK = (((this.nFiltered++) % this.filterN) == 0); +this.bsFilter.setBitTo(iAtom >= 0 ? iAtom : this.asc.ac, isOK); +return isOK; +}, "J.adapter.smarter.Atom,~N"); +Clazz.defineMethod(c$, "checkFilter", +function(atom, f, fCased){ +if (atom.isHetero && this.filterAllHetero) return true; +return (!this.filterGroup3 || atom.group3 == null || !this.filterReject(f, "[", atom.group3.toUpperCase() + "]")) && (!this.filterAtomName || this.allowAtomName(atom.atomName, f)) && (this.filterAtomTypeStr == null || atom.atomName == null || atom.atomName.toUpperCase().indexOf("\0" + this.filterAtomTypeStr) >= 0) && (!this.filterElement || atom.elementSymbol == null || !this.filterReject(f, "_", atom.elementSymbol.toUpperCase() + ";")) && (!this.filterChain || atom.chainID == 0 || !this.filterReject(fCased, ":", "" + this.vwr.getChainIDStr(atom.chainID))) && (!this.filterAltLoc || atom.altLoc == '\0' || !this.filterReject(f, "%", "" + atom.altLoc)) && (!this.filterHetero || !this.allowPDBFilter || !this.filterReject(f, "HETATM", atom.isHetero ? "-Y" : "-N")); +}, "J.adapter.smarter.Atom,~S,~S"); +Clazz.defineMethod(c$, "rejectAtomName", +function(name){ +return this.filterAtomName && !this.allowAtomName(name, this.filter); +}, "~S"); +Clazz.defineMethod(c$, "allowAtomName", +function(atomName, f){ +return (atomName == null || !this.filterReject(f, ".", atomName.toUpperCase() + this.filterAtomNameTerminator)); +}, "~S,~S"); +Clazz.defineMethod(c$, "filterReject", +function(f, code, atomCode){ +return (f.indexOf(code) >= 0 && (f.indexOf("!" + code) >= 0) == (f.indexOf(code + atomCode) >= 0)); +}, "~S,~S,~S"); +Clazz.defineMethod(c$, "set2D", +function(){ +this.asc.setInfo("is2D", Boolean.TRUE); +this.asc.getBSAtoms(-1); +if (this.noHydrogens) { +this.asc.setInfo("noHydrogen", Boolean.TRUE); +this.optimize2D = false; +}if (this.optimize2D) { +this.asc.fix2Stereo(); +this.asc.setInfo("doMinimize", Boolean.TRUE); +this.appendLoadNote("This model is 2D. Its 3D structure was generated."); +} else { +this.appendLoadNote("This model is 2D. Its 3D structure has not been generated; use LOAD \"\" FILTER \"2D\" to optimize 3D."); +this.addJmolScript("select thismodel;wireframe only"); +}}); +Clazz.defineMethod(c$, "doGetVibration", +function(vibrationNumber){ +return this.addVibrations && (this.desiredVibrationNumber <= 0 || vibrationNumber == this.desiredVibrationNumber); +}, "~N"); +Clazz.defineMethod(c$, "setTransform", +function(x1, y1, z1, x2, y2, z2, x3, y3, z3){ +if (this.matRot != null || !this.doSetOrientation) return; +this.matRot = new JU.M3(); +var v = JU.V3.new3(x1, y1, z1); +v.normalize(); +this.matRot.setColumnV(0, v); +v.set(x2, y2, z2); +v.normalize(); +this.matRot.setColumnV(1, v); +v.set(x3, y3, z3); +v.normalize(); +this.matRot.setColumnV(2, v); +this.asc.setInfo("defaultOrientationMatrix", JU.M3.newM3(this.matRot)); +var q = JU.Quat.newM(this.matRot); +this.asc.setInfo("defaultOrientationQuaternion", q); +JU.Logger.info("defaultOrientationMatrix = " + this.matRot); +}, "~N,~N,~N,~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "setAtomCoordXYZ", +function(atom, x, y, z){ +atom.set(x, y, z); +this.setAtomCoord(atom); +}, "J.adapter.smarter.Atom,~N,~N,~N"); +Clazz.defineMethod(c$, "setAtomCoordScaled", +function(atom, tokens, i, f){ +if (atom == null) atom = this.asc.addNewAtom(); +this.setAtomCoordXYZ(atom, this.parsePrecision(tokens[i]) * f, this.parsePrecision(tokens[i + 1]) * f, this.parsePrecision(tokens[i + 2]) * f); +return atom; +}, "J.adapter.smarter.Atom,~A,~N,~N"); +Clazz.defineMethod(c$, "setAtomCoordTokens", +function(atom, tokens, i){ +this.setAtomCoordXYZ(atom, this.parsePrecision(tokens[i]), this.parsePrecision(tokens[i + 1]), this.parsePrecision(tokens[i + 2])); +}, "J.adapter.smarter.Atom,~A,~N"); +Clazz.defineMethod(c$, "addAtomXYZSymName", +function(tokens, i, sym, name){ +var atom = this.asc.addNewAtom(); +if (sym != null) atom.elementSymbol = sym; +if (name != null) atom.atomName = name; +this.setAtomCoordTokens(atom, tokens, i); +return atom; +}, "~A,~N,~S,~S"); +Clazz.defineMethod(c$, "setAtomCoord", +function(atom){ +var mustFractionalize = (this.doConvertToFractional && !this.fileCoordinatesAreFractional && this.getSymmetry() != null); +if (this.fileScaling != null) { +atom.x = atom.x * this.fileScaling.x + this.fileOffset.x; +atom.y = atom.y * this.fileScaling.y + this.fileOffset.y; +atom.z = atom.z * this.fileScaling.z + this.fileOffset.z; +}if (mustFractionalize) { +if (!this.symmetry.haveUnitCell()) this.symmetry.setUnitCellFromParams(this.unitCellParams, false, NaN); +this.symmetry.toFractional(atom, false); +this.iHaveFractionalCoordinates = true; +}if (this.floatifyJavaDouble && this.fileCoordinatesAreFractional) this.fixFloatPt(atom, 100000.0); +this.doCheckUnitCell = true; +}, "J.adapter.smarter.Atom"); +Clazz.defineMethod(c$, "addSites", +function(htSites){ +this.asc.setCurrentModelInfo("pdbSites", htSites); +var sites = ""; +for (var entry, $entry = htSites.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) { +var name = entry.getKey(); +var htSite = entry.getValue(); +var ch; +for (var i = name.length; --i >= 0; ) if (!JU.PT.isLetterOrDigit(ch = name.charAt(i)) && ch != '\'') name = name.substring(0, i) + "_" + name.substring(i + 1); + +var groups = htSite.get("groups"); +if (groups.length == 0) continue; +this.addSiteScript("@site_" + name + " " + groups); +this.addSiteScript("site_" + name + " = [\"" + JU.PT.rep(groups, ",", "\",\"") + "\"]"); +sites += ",\"site_" + name + "\""; +} +if (sites.length > 0) this.addSiteScript("site_list = [" + sites.substring(1) + "]"); +}, "java.util.Map"); +Clazz.defineMethod(c$, "applySymmetryAndSetTrajectory", +function(){ +this.applySymTrajASCR(); +}); +Clazz.defineMethod(c$, "applySymTrajASCR", +function(){ +if (this.forcePacked) this.initializeSymmetryOptions(); +var doApply = (this.iHaveUnitCell && this.doCheckUnitCell); +var sym = null; +if (doApply) { +sym = this.getSymmetry(); +this.setPrecision(); +sym = this.asc.getXSymmetry().applySymmetryFromReader(sym); +} else { +this.asc.setTensors(); +}if (this.isTrajectory) this.asc.setTrajectory(); +if (this.moreUnitCellInfo != null) { +this.asc.setCurrentModelInfo("moreUnitCellInfo", this.moreUnitCellInfo); +this.moreUnitCellInfo = null; +}this.finalizeSubclassSymmetry(sym != null); +if (this.merging && sym != null && this.iHaveFractionalCoordinates && this.iHaveUnitCell && this.iHaveSymmetryOperators) { +this.fractionalizeCoordinates(false); +this.addJmolScript("modelkit spacegroup P1"); +}this.initializeSymmetry(); +return sym; +}); +Clazz.defineMethod(c$, "finalizeSubclassSymmetry", +function(haveSymmetry){ +}, "~B"); +Clazz.defineMethod(c$, "doPreSymmetry", +function(){ +}); +Clazz.defineMethod(c$, "finalizeMOData", +function(moData){ +this.asc.setCurrentModelInfo("moData", moData); +if (moData == null) return; +var orbitals = moData.get("mos"); +if (orbitals != null) JU.Logger.info(orbitals.size() + " molecular orbitals read in model " + this.asc.atomSetCount); +}, "java.util.Map"); +c$.getElementSymbol = Clazz.defineMethod(c$, "getElementSymbol", +function(elementNumber){ +return J.api.JmolAdapter.getElementSymbol(elementNumber); +}, "~N"); +Clazz.defineMethod(c$, "fillDataBlock", +function(data, minLineLen){ +var nLines = data.length; +for (var i = 0; i < nLines; i++) { +data[i] = JU.PT.getTokens(this.discardLinesUntilNonBlank()); +if (data[i].length < minLineLen) --i; +} +}, "~A,~N"); +Clazz.defineMethod(c$, "fill3x3", +function(tokens, pt){ +var a = Clazz.newDoubleArray (3, 3, 0); +var needTokens = (tokens == null); +var pt0 = pt; +for (var i = 0; i < 3; i++) { +if (needTokens || pt >= tokens.length) { +while ((tokens = JU.PT.getTokens(this.rd())).length < 3) { +} +pt = (pt0 < 0 ? tokens.length + pt0 : pt0); +}for (var j = 0; j < 3; j++) a[i][j] = Double.$valueOf(tokens[pt++]).doubleValue(); + +} +return a; +}, "~A,~N"); +Clazz.defineMethod(c$, "fillFloatArray", +function(s, width, data){ +var tokens = new Array(0); +var pt = 0; +for (var i = 0; i < data.length; i++) { +while (tokens != null && pt >= tokens.length) { +if (s == null) s = this.rd(); +if (width == 0) { +tokens = JU.PT.getTokens(s); +} else { +tokens = new Array(Clazz.doubleToInt(s.length / width)); +for (var j = 0; j < tokens.length; j++) tokens[j] = s.substring(j * width, (j + 1) * width); + +}s = null; +pt = 0; +} +if (tokens == null) break; +data[i] = this.parseFloatStr(tokens[pt++]); +} +return data; +}, "~S,~N,~A"); +Clazz.defineMethod(c$, "fillFrequencyData", +function(iAtom0, ac, modelAtomCount, ignore, isWide, col0, colWidth, atomIndexes, minLineLen, data){ +var withSymmetry = (ac != 0 && modelAtomCount != ac && data == null); +if (ac == 0 && atomIndexes != null) ac = atomIndexes.length; +var nLines = (isWide ? ac : ac * 3); +var nFreq = ignore.length; +if (data == null) { +data = new Array(nLines); +this.fillDataBlockFixed(data, col0, colWidth, minLineLen); +} else if (!isWide) { +var ptNonblank = minLineLen; +this.fillDataBlockFixed(data, col0, colWidth, -ptNonblank); +if (data[0] == null) return; +iAtom0 += this.parseIntAt(this.line, ptNonblank - 5) - 1; +}for (var i = 0, atomPt = 0; i < nLines; i++, atomPt++) { +var values = data[i]; +var valuesY = (isWide ? null : data[++i]); +var valuesZ = (isWide ? null : data[++i]); +var dataPt = values.length - (isWide ? nFreq * 3 : nFreq) - 1; +for (var j = 0, jj = 0; jj < nFreq; jj++) { +++dataPt; +var x = values[dataPt]; +if (x.charAt(0) == ')') x = x.substring(1); +var vx = this.parseFloatStr(x); +var vy = this.parseFloatStr(isWide ? values[++dataPt] : valuesY[dataPt]); +var vz = this.parseFloatStr(isWide ? values[++dataPt] : valuesZ[dataPt]); +if (ignore[jj]) continue; +var iAtom = (atomIndexes == null ? atomPt : atomIndexes[atomPt]); +if (iAtom < 0) continue; +iAtom += iAtom0 + modelAtomCount * j++; +if (this.debugging) JU.Logger.debug("atom " + iAtom + " vib" + j + ": " + vx + " " + vy + " " + vz); +this.asc.addVibrationVectorWithSymmetry(iAtom, vx, vy, vz, withSymmetry); +} +} +}, "~N,~N,~N,~A,~B,~N,~N,~A,~N,~A"); +Clazz.defineMethod(c$, "fillDataBlockFixed", +function(data, col0, colWidth, minLineLen){ +if (colWidth == 0) { +this.fillDataBlock(data, minLineLen); +return; +}var nLines = data.length; +for (var i = 0; i < nLines; i++) { +this.discardLinesUntilNonBlank(); +if (minLineLen < 0 && this.line.charAt(-minLineLen) == ' ') { +data[0] = null; +return; +}var nFields = Clazz.doubleToInt((this.line.length - col0 + 1) / colWidth); +data[i] = new Array(nFields); +for (var j = 0, start = col0; j < nFields; j++, start += colWidth) data[i][j] = this.line.substring(start, Math.min(this.line.length, start + colWidth)); + +} +}, "~A,~N,~N,~N"); +Clazz.defineMethod(c$, "readLines", +function(nLines){ +for (var i = nLines; --i >= 0; ) this.rd(); + +return this.line; +}, "~N"); +Clazz.defineMethod(c$, "discardLinesUntilStartsWith", +function(startsWith){ +while (this.rd() != null && !this.line.startsWith(startsWith)) { +} +return this.line; +}, "~S"); +Clazz.defineMethod(c$, "discardLinesUntilContains", +function(containsMatch){ +while (this.rd() != null && this.line.indexOf(containsMatch) < 0) { +} +return this.line; +}, "~S"); +Clazz.defineMethod(c$, "discardLinesUntilContains2", +function(s1, s2){ +while (this.rd() != null && this.line.indexOf(s1) < 0 && this.line.indexOf(s2) < 0) { +} +return this.line; +}, "~S,~S"); +Clazz.defineMethod(c$, "discardLinesUntilBlank", +function(){ +while (this.rd() != null && this.line.trim().length != 0) { +} +return this.line; +}); +Clazz.defineMethod(c$, "discardLinesUntilNonBlank", +function(){ +while (this.rd() != null && this.line.trim().length == 0) { +} +return this.line; +}); +Clazz.defineMethod(c$, "checkLineForScript", +function(line){ +this.line = line; +this.checkCurrentLineForScript(); +}, "~S"); +Clazz.defineMethod(c$, "checkCurrentLineForScript", +function(){ +if (this.line.endsWith("#noautobond")) { +this.line = this.line.substring(0, this.line.lastIndexOf('#')).trim(); +this.asc.setNoAutoBond(); +}var pt = this.line.indexOf("jmolscript:"); +if (pt >= 0) { +var script = this.line.substring(pt + 11, this.line.length); +if (script.indexOf("#") >= 0) { +script = script.substring(0, script.indexOf("#")); +}this.addJmolScript(script); +this.line = this.line.substring(0, pt).trim(); +}}); +Clazz.defineMethod(c$, "addJmolScript", +function(script){ +JU.Logger.info("#jmolScript: " + script); +if (this.previousScript == null) this.previousScript = ""; + else if (!this.previousScript.endsWith(";")) this.previousScript += ";"; +this.previousScript += script; +this.asc.setInfo("jmolscript", this.previousScript); +}, "~S"); +Clazz.defineMethod(c$, "addSiteScript", +function(script){ +if (this.siteScript == null) this.siteScript = ""; + else if (!this.siteScript.endsWith(";")) this.siteScript += ";"; +this.siteScript += script; +this.asc.setInfo("sitescript", this.siteScript); +}, "~S"); +Clazz.defineMethod(c$, "rd", +function(){ +return this.RL(); +}); +Clazz.defineMethod(c$, "RL", +function(){ +this.prevline = this.line; +this.line = this.reader.readLine(); +if (this.out != null && this.line != null) this.out.append(this.line).append("\n"); +this.ptLine++; +if (this.debugging && this.line != null) JU.Logger.info(this.line); +return this.line; +}); +c$.getStrings = Clazz.defineMethod(c$, "getStrings", +function(sinfo, nFields, width){ +var fields = new Array(nFields); +for (var i = 0, pt = 0; i < nFields; i++, pt += width) fields[i] = sinfo.substring(pt, pt + width); + +return fields; +}, "~S,~N,~N"); +Clazz.defineMethod(c$, "getTokens", +function(){ +return JU.PT.getTokens(this.line); +}); +c$.getTokensFloat = Clazz.defineMethod(c$, "getTokensFloat", +function(s, f, n){ +if (f == null) f = Clazz.newFloatArray (n, 0); +JU.PT.parseFloatArrayDataN(JU.PT.getTokens(s), f, n); +return f; +}, "~S,~A,~N"); +Clazz.defineMethod(c$, "parseFloat", +function(){ +return JU.PT.parseFloatNext(this.line, this.next); +}); +Clazz.defineMethod(c$, "parseFloatStr", +function(s){ +this.next[0] = 0; +return JU.PT.parseFloatNext(s, this.next); +}, "~S"); +Clazz.defineMethod(c$, "parseFloatRange", +function(s, iStart, iEnd){ +this.next[0] = iStart; +return JU.PT.parseFloatRange(s, iEnd, this.next); +}, "~S,~N,~N"); +Clazz.defineMethod(c$, "parseInt", +function(){ +return JU.PT.parseIntNext(this.line, this.next); +}); +Clazz.defineMethod(c$, "parseIntStr", +function(s){ +this.next[0] = 0; +return JU.PT.parseIntNext(s, this.next); +}, "~S"); +Clazz.defineMethod(c$, "parseIntAt", +function(s, iStart){ +this.next[0] = iStart; +return JU.PT.parseIntNext(s, this.next); +}, "~S,~N"); +Clazz.defineMethod(c$, "parseIntRange", +function(s, iStart, iEnd){ +this.next[0] = iStart; +return JU.PT.parseIntRange(s, iEnd, this.next); +}, "~S,~N,~N"); +Clazz.defineMethod(c$, "parseToken", +function(){ +return JU.PT.parseTokenNext(this.line, this.next); +}); +Clazz.defineMethod(c$, "parseTokenStr", +function(s){ +this.next[0] = 0; +return JU.PT.parseTokenNext(s, this.next); +}, "~S"); +Clazz.defineMethod(c$, "parseTokenNext", +function(s){ +return JU.PT.parseTokenNext(s, this.next); +}, "~S"); +Clazz.defineMethod(c$, "parseTokenRange", +function(s, iStart, iEnd){ +this.next[0] = iStart; +return JU.PT.parseTokenRange(s, iEnd, this.next); +}, "~S,~N,~N"); +c$.getFortranFormatLengths = Clazz.defineMethod(c$, "getFortranFormatLengths", +function(s){ +var vdata = new JU.Lst(); +var n = 0; +var c = 0; +var factor = 1; +var inN = false; +var inCount = true; +s += ","; +for (var i = 0; i < s.length; i++) { +var ch = s.charAt(i); +switch ((ch).charCodeAt(0)) { +case 46: +inN = false; +continue; +case 44: +for (var j = 0; j < c; j++) vdata.addLast(Integer.$valueOf(n * factor)); + +inN = false; +inCount = true; +c = 0; +continue; +case 88: +n = c; +c = 1; +factor = -1; +continue; +} +var isDigit = JU.PT.isDigit(ch); +if (isDigit) { +if (inN) n = n * 10 + ch.charCodeAt(0) - 48; + else if (inCount) c = c * 10 + ch.charCodeAt(0) - 48; +} else if (JU.PT.isLetter(ch)) { +n = 0; +inN = true; +inCount = false; +factor = 1; +} else { +inN = false; +}} +return vdata; +}, "~S"); +Clazz.defineMethod(c$, "read3Vectors", +function(isBohr){ +var vectors = new Array(3); +var f = Clazz.newFloatArray (3, 0); +for (var i = 0; i < 3; i++) { +if (i > 0 || Float.isNaN(this.parseFloatStr(this.line))) { +this.rd(); +if (i == 0 && this.line != null) { +i = -1; +continue; +}}this.fillFloatArray(this.line, 0, f); +vectors[i] = new JU.V3(); +vectors[i].setA(f); +if (isBohr) vectors[i].scale(0.5291772); +} +return vectors; +}, "~B"); +Clazz.defineMethod(c$, "setElementAndIsotope", +function(atom, str){ +var isotope = this.parseIntStr(str); +if (isotope == -2147483648) { +atom.elementSymbol = str; +} else { +str = str.substring(("" + isotope).length); +atom.elementNumber = (str.length == 0 ? isotope : ((isotope << 7) + J.api.JmolAdapter.getElementNumber(str))); +}}, "J.adapter.smarter.Atom,~S"); +Clazz.defineMethod(c$, "finalizeModelSet", +function(){ +}); +Clazz.defineMethod(c$, "setChainID", +function(atom, label){ +atom.chainID = this.vwr.getChainID(label, true); +}, "J.adapter.smarter.Atom,~S"); +Clazz.overrideMethod(c$, "readNextLine", +function(){ +if (this.rd() != null && this.line.indexOf("#jmolscript:") >= 0) this.checkCurrentLineForScript(); +return this.line; +}); +Clazz.defineMethod(c$, "appendUunitCellInfo", +function(info){ +if (this.moreUnitCellInfo == null) this.moreUnitCellInfo = new JU.Lst(); +this.moreUnitCellInfo.addLast(info); +this.appendLoadNote(info); +}, "~S"); +Clazz.defineMethod(c$, "getInterface", +function(className){ +var o = J.api.Interface.getInterface(className, this.vwr, "file"); +if (o == null) throw new NullPointerException("Interface"); +return o; +}, "~S"); +Clazz.defineMethod(c$, "forceSymmetry", +function(andPack){ +if (andPack) this.doPackUnitCell = andPack; +if (!this.doApplySymmetry) { +this.doApplySymmetry = true; +this.latticeCells[0] = this.latticeCells[1] = this.latticeCells[2] = 1; +}}, "~B"); +Clazz.defineMethod(c$, "fixFloatA", +function(pts){ +if (this.floatifyJavaDouble) for (var i = pts.length; --i >= 0; ) if (!Float.isNaN(pts[i])) pts[i] = JU.PT.fixFloat(pts[i], 100000.0); + +}, "~A"); +Clazz.defineMethod(c$, "fixDoubleA", +function(pts){ +if (this.floatifyJavaDouble) for (var i = pts.length; --i >= 0; ) if (!Double.isNaN(pts[i])) pts[i] = JU.PT.fixDouble(pts[i], 100000.0); + +}, "~A"); +Clazz.defineMethod(c$, "fixFloatPt", +function(pt, prec){ +if (this.floatifyJavaDouble) JU.PT.fixPtFloats(pt, prec); +}, "JU.P3,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/AtomSetObject.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/AtomSetObject.js new file mode 100755 index 000000000000..9db13d486e6e --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/AtomSetObject.js @@ -0,0 +1,7 @@ +Clazz.declarePackage("J.adapter.smarter"); +(function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.atomSetIndex = 0; +Clazz.instantialize(this, arguments);}, J.adapter.smarter, "AtomSetObject", null); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/Bond.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/Bond.js new file mode 100755 index 000000000000..5a34304cb2b7 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/Bond.js @@ -0,0 +1,24 @@ +Clazz.declarePackage("J.adapter.smarter"); +Clazz.load(["J.adapter.smarter.AtomSetObject"], "J.adapter.smarter.Bond", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.atomIndex1 = 0; +this.atomIndex2 = 0; +this.order = 0; +this.radius = -1; +this.colix = -1; +this.uniqueID = -1; +this.distance = 0; +Clazz.instantialize(this, arguments);}, J.adapter.smarter, "Bond", J.adapter.smarter.AtomSetObject); +Clazz.makeConstructor(c$, +function(atomIndex1, atomIndex2, order){ +Clazz.superConstructor (this, J.adapter.smarter.Bond, []); +this.atomIndex1 = atomIndex1; +this.atomIndex2 = atomIndex2; +this.order = order; +}, "~N,~N,~N"); +Clazz.overrideMethod(c$, "toString", +function(){ +return "[Bond " + this.atomIndex1 + " " + this.atomIndex2 + " " + this.order + "]"; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/BondIterator.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/BondIterator.js new file mode 100755 index 000000000000..9bd28bd28e76 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/BondIterator.js @@ -0,0 +1,46 @@ +Clazz.declarePackage("J.adapter.smarter"); +Clazz.load(["J.api.JmolAdapterBondIterator"], "J.adapter.smarter.BondIterator", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.bsAtoms = null; +this.bonds = null; +this.ibond = 0; +this.bond = null; +this.bondCount = 0; +Clazz.instantialize(this, arguments);}, J.adapter.smarter, "BondIterator", J.api.JmolAdapterBondIterator); +Clazz.makeConstructor(c$, +function(asc){ +Clazz.superConstructor (this, J.adapter.smarter.BondIterator, []); +this.bsAtoms = asc.bsAtoms; +this.bonds = asc.bonds; +this.bondCount = asc.bondCount; +this.ibond = 0; +}, "J.adapter.smarter.AtomSetCollection"); +Clazz.overrideMethod(c$, "hasNext", +function(){ +if (this.ibond == this.bondCount) return false; +while ((this.bond = this.bonds[this.ibond++]) == null || (this.bsAtoms != null && (!this.bsAtoms.get(this.bond.atomIndex1) || !this.bsAtoms.get(this.bond.atomIndex2)))) if (this.ibond == this.bondCount) return false; + +return true; +}); +Clazz.overrideMethod(c$, "getAtomUniqueID1", +function(){ +return Integer.$valueOf(this.bond.atomIndex1); +}); +Clazz.overrideMethod(c$, "getAtomUniqueID2", +function(){ +return Integer.$valueOf(this.bond.atomIndex2); +}); +Clazz.overrideMethod(c$, "getEncodedOrder", +function(){ +return this.bond.order; +}); +Clazz.overrideMethod(c$, "getRadius", +function(){ +return this.bond.radius; +}); +Clazz.overrideMethod(c$, "getColix", +function(){ +return this.bond.colix; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/MSInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/MSInterface.js new file mode 100755 index 000000000000..19af8c9701da --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/MSInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.adapter.smarter"); +Clazz.declareInterface(J.adapter.smarter, "MSInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/Resolver.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/Resolver.js new file mode 100755 index 000000000000..cc9d71328548 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/Resolver.js @@ -0,0 +1,487 @@ +Clazz.declarePackage("J.adapter.smarter"); +Clazz.load(null, "J.adapter.smarter.Resolver", ["java.io.BufferedInputStream", "java.util.StringTokenizer", "JU.LimitedLineReader", "$.PT", "$.Rdr", "J.adapter.smarter.AtomSetCollectionReader", "$.SmarterJmolAdapter", "J.api.Interface", "JU.Logger", "JV.JC"], function(){ +var c$ = Clazz.declareType(J.adapter.smarter, "Resolver", null); +c$.getReaderClassBase = Clazz.defineMethod(c$, "getReaderClassBase", +function(type){ +var name = type + "Reader"; +if (type.startsWith("Xml")) return "J.adapter.readers." + "xml." + name; +var key = ";" + type + ";"; +for (var i = 1; i < J.adapter.smarter.Resolver.readerSets.length; i += 2) if (J.adapter.smarter.Resolver.readerSets[i].indexOf(key) >= 0) return "J.adapter.readers." + J.adapter.smarter.Resolver.readerSets[i - 1] + name; + +return "J.adapter.readers." + "???." + name; +}, "~S"); +c$.getFileType = Clazz.defineMethod(c$, "getFileType", +function(br){ +try { +return J.adapter.smarter.Resolver.determineAtomSetCollectionReader(br, null); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +return null; +} else { +throw e; +} +} +}, "java.io.BufferedReader"); +c$.getAtomCollectionReader = Clazz.defineMethod(c$, "getAtomCollectionReader", +function(fullName, type, readerOrDocument, htParams, ptFile){ +var readerName; +fullName = J.adapter.smarter.Resolver.fixDOSName(fullName); +var errMsg = null; +if (type == null && htParams != null) { +type = J.adapter.smarter.Resolver.getFileTypefromFilter(htParams.get("filter")); +}if (type != null) { +readerName = J.adapter.smarter.Resolver.getReaderFromType(type); +if (readerName == null) readerName = J.adapter.smarter.Resolver.getReaderFromType("Xml" + type); +if (readerName == null) errMsg = "unrecognized file format type " + type + " file=" + fullName; + else JU.Logger.info("The Resolver assumes " + readerName + " file=" + fullName); +} else { +readerName = J.adapter.smarter.Resolver.determineAtomSetCollectionReader(readerOrDocument, htParams); +if (readerName.charAt(0) == '\n') { +type = (htParams == null ? null : htParams.get("defaultType")); +if (type != null) { +type = J.adapter.smarter.Resolver.getReaderFromType(type); +if (type != null) readerName = type; +}}if (readerName.charAt(0) == '\n') errMsg = "unrecognized file format for file\n" + fullName + "\n" + J.adapter.smarter.Resolver.split(readerName, 50); + else if (readerName.equals("spt")) errMsg = "NOTE: file recognized as a script file: " + fullName + "\n"; + else if (!fullName.equals("ligand")) JU.Logger.info("The Resolver thinks " + readerName); +}if (errMsg != null) { +J.adapter.smarter.SmarterJmolAdapter.close(readerOrDocument); +return errMsg; +}htParams.put("ptFile", Integer.$valueOf(ptFile)); +if (ptFile <= 0) htParams.put("readerName", readerName); +return J.adapter.smarter.Resolver.getReader(readerName, htParams); +}, "~S,~S,~O,java.util.Map,~N"); +c$.getReader = Clazz.defineMethod(c$, "getReader", +function(readerName, htParams){ +var rdr = null; +var className = null; +var err = null; +className = J.adapter.smarter.Resolver.getReaderClassBase(readerName); +if ((rdr = J.api.Interface.getInterface(className, null, "reader")) == null) { +err = JV.JC.READER_NOT_FOUND + className; +JU.Logger.error(err); +return err; +}return rdr; +}, "~S,java.util.Map"); +c$.getReaderFromType = Clazz.defineMethod(c$, "getReaderFromType", +function(type){ +if (type.endsWith("(XML)")) { +type = "Xml" + type.substring(0, type.length - 5); +}type = ";" + type.toLowerCase() + ";"; +if (";zmatrix;cfi;c;vfi;v;mnd;jag;gms;g;gau;mp;nw;orc;pqs;qc;".indexOf(type) >= 0) return "Input"; +var set; +var pt; +for (var i = J.adapter.smarter.Resolver.readerSets.length; --i >= 0; ) { +if ((pt = (set = J.adapter.smarter.Resolver.readerSets[i--]).toLowerCase().indexOf(type)) >= 0) return set.substring(pt + 1, set.indexOf(";", pt + 2)); +} +return null; +}, "~S"); +c$.split = Clazz.defineMethod(c$, "split", +function(a, n){ +var s = ""; +var l = a.length; +for (var i = 0, j = 0; i < l; i = j) s += a.substring(i, (j = Math.min(i + n, l))) + "\n"; + +return s; +}, "~S,~N"); +c$.DOMResolve = Clazz.defineMethod(c$, "DOMResolve", +function(htParams){ +var rdrName = J.adapter.smarter.Resolver.getXmlType(htParams.get("nameSpaceInfo")); +if (JU.Logger.debugging) { +JU.Logger.debug("The Resolver thinks " + rdrName); +}htParams.put("readerName", rdrName); +return J.adapter.smarter.Resolver.getReader("XmlReader", htParams); +}, "java.util.Map"); +c$.determineAtomSetCollectionReader = Clazz.defineMethod(c$, "determineAtomSetCollectionReader", +function(readerOrDocument, htParams){ +var readerName; +if (Clazz.instanceOf(readerOrDocument,"javajs.api.GenericBinaryDocument")) { +var doc = readerOrDocument; +readerName = J.adapter.smarter.Resolver.getBinaryType(doc.getInputStream()); +return (readerName == null ? "binary file type not recognized" : readerName); +}if (Clazz.instanceOf(readerOrDocument,"java.io.InputStream")) { +readerName = J.adapter.smarter.Resolver.getBinaryType(readerOrDocument); +if (readerName != null) return readerName; +readerOrDocument = JU.Rdr.getBufferedReader( new java.io.BufferedInputStream(readerOrDocument), null); +}var rdr = readerOrDocument; +var llr = new JU.LimitedLineReader(rdr, 16384); +var leader = llr.getHeader(64).trim(); +if (leader.length == 0) throw new java.io.EOFException("File contains no data."); +if (leader.indexOf("PNG") == 1 && leader.indexOf("PNGJ") >= 0) return "pngj"; +if (leader.indexOf("PNG") == 1 || leader.indexOf("JPG") == 1 || leader.indexOf("JFIF") == 6) return "spt"; +if (leader.indexOf("\"num_pairs\"") >= 0) return "dssr"; +if (leader.indexOf("output.31\n") >= 0) return "GenNBO|output.31"; +if ((readerName = J.adapter.smarter.Resolver.checkFileStart(leader)) != null) { +return (readerName.equals("Xml") ? J.adapter.smarter.Resolver.getXmlType(llr.getHeader(0)) : readerName); +}var msg; +var isJSONMap = (leader.charAt(0) == '{'); +var lines = new Array(16); +var nLines = 0; +for (var i = 0; i < lines.length; ++i) { +lines[i] = llr.readLineWithNewline(); +if (lines[i].length > 0) nLines++; +} +if ((readerName = J.adapter.smarter.Resolver.checkSpecial1(nLines, lines, leader)) != null) return readerName; +if ((readerName = J.adapter.smarter.Resolver.checkLineStarts(lines)) != null) return readerName; +if ((readerName = J.adapter.smarter.Resolver.checkHeaderContains(llr.getHeader(0))) != null) { +return readerName; +}if ((readerName = J.adapter.smarter.Resolver.checkSpecial2(lines)) != null) return readerName; +if (isJSONMap) { +var json = rdr.readLine(); +if ((readerName = J.adapter.smarter.Resolver.checkJSONContains(json)) != null) { +if (htParams != null) htParams.put("fileData", json); +return readerName; +}msg = (htParams == null ? null : json.substring(0, Math.min(100, json.length))); +} else { +msg = (htParams == null ? null : "\n" + lines[0] + "\n" + lines[1] + "\n" + lines[2] + "\n"); +}return msg; +}, "~O,java.util.Map"); +c$.getBinaryType = Clazz.defineMethod(c$, "getBinaryType", +function(inputStream){ +var magic4 = null; +return (JU.Rdr.isPickleS(inputStream) ? "PyMOL" : (JU.Rdr.getMagic(inputStream, 1)[0] & 0xFF) == 0xDE ? "MMTF" : (JU.Rdr.getMagic(inputStream, 10)[9] & 0xFF) == 0xB6 ? "BCIF" : J.adapter.smarter.Resolver.bytesMatch((magic4 = JU.Rdr.getMagic(inputStream, 4)), J.adapter.smarter.Resolver.cdxMagic) ? "CDX" : J.adapter.smarter.Resolver.bytesMatch(magic4, J.adapter.smarter.Resolver.cmdfMagic) ? "Cmdf" : null); +}, "java.io.InputStream"); +c$.bytesMatch = Clazz.defineMethod(c$, "bytesMatch", +function(a, b){ +if (b.length > a.length) return false; +for (var i = b.length; --i >= 0; ) { +if (a[i] != b[i]) return false; +} +return true; +}, "~A,~A"); +c$.checkFileStart = Clazz.defineMethod(c$, "checkFileStart", +function(leader){ +for (var i = 0; i < J.adapter.smarter.Resolver.fileStartsWithRecords.length; ++i) { +var recordTags = J.adapter.smarter.Resolver.fileStartsWithRecords[i]; +for (var j = 1; j < recordTags.length; ++j) { +var recordTag = recordTags[j]; +if (leader.startsWith(recordTag)) return recordTags[0]; +} +} +return null; +}, "~S"); +c$.checkSpecial1 = Clazz.defineMethod(c$, "checkSpecial1", +function(nLines, lines, leader){ +if (nLines == 1 && lines[0].length > 0 && JU.PT.isDigit(lines[0].charAt(0))) return "Jme"; +if (J.adapter.smarter.Resolver.checkMopacGraphf(lines)) return "MopacGraphf"; +if (J.adapter.smarter.Resolver.checkOdyssey(lines)) return "Odyssey"; +switch (J.adapter.smarter.Resolver.checkMol(lines)) { +case 1: +case 3: +case 2000: +case 3000: +return "Mol"; +} +switch (J.adapter.smarter.Resolver.checkXyz(lines)) { +case 1: +return "Xyz"; +case 2: +return "Bilbao"; +case 3: +return "PWmat"; +} +if (J.adapter.smarter.Resolver.checkAlchemy(lines[0])) return "Alchemy"; +if (J.adapter.smarter.Resolver.checkFoldingXyz(lines)) return "FoldingXyz"; +if (J.adapter.smarter.Resolver.checkXSF(lines)) return "Xcrysden"; +if (J.adapter.smarter.Resolver.checkCube(lines)) return "Cube"; +if (J.adapter.smarter.Resolver.checkWien2k(lines)) return "Wien2k"; +if (J.adapter.smarter.Resolver.checkAims(lines)) return "Aims"; +if (J.adapter.smarter.Resolver.checkGenNBO(lines, leader)) return "GenNBO"; +return null; +}, "~N,~A,~S"); +c$.checkXSF = Clazz.defineMethod(c$, "checkXSF", +function(lines){ +var i = 0; +while (lines[i].length == 0) { +i++; +} +return (lines[i].startsWith("ANIMSTEPS ") || lines[i].equals("ATOMS\n") && JU.PT.parseInt(lines[i + 1]) > 0); +}, "~A"); +c$.checkAims = Clazz.defineMethod(c$, "checkAims", +function(lines){ +for (var i = 0; i < lines.length; i++) { +if (lines[i].startsWith("mol 1")) return false; +var tokens = JU.PT.getTokens(lines[i]); +if (tokens.length == 0) continue; +if (tokens[0].startsWith("atom") && tokens.length > 4 && Float.isNaN(JU.PT.parseFloat(tokens[4])) || tokens[0].startsWith("multipole") && tokens.length >= 6 || tokens[0].startsWith("lattice_vector") && tokens.length >= 4) return true; +} +return false; +}, "~A"); +c$.checkAlchemy = Clazz.defineMethod(c$, "checkAlchemy", +function(line){ +var pt; +if ((pt = line.indexOf("ATOMS")) > 0 && line.indexOf("BONDS") > pt) { +var n = JU.PT.parseInt(line.substring(0, pt).trim()); +return (n > 0); +}return false; +}, "~S"); +c$.isInt = Clazz.defineMethod(c$, "isInt", +function(s){ +J.adapter.smarter.Resolver.n[0] = 0; +s = s.trim(); +return s.length > 0 && JU.PT.parseIntNext(s, J.adapter.smarter.Resolver.n) != -2147483648 && J.adapter.smarter.Resolver.n[0] == s.length; +}, "~S"); +c$.isFloat = Clazz.defineMethod(c$, "isFloat", +function(s){ +return !Float.isNaN(JU.PT.parseFloat(s)); +}, "~S"); +c$.checkCube = Clazz.defineMethod(c$, "checkCube", +function(lines){ +for (var j = 2; j <= 5; j++) { +var tokens2 = new java.util.StringTokenizer(lines[j]); +var n = tokens2.countTokens(); +if (!(n == 4 || j == 2 && n == 5) || !J.adapter.smarter.Resolver.isInt(tokens2.nextToken())) return false; +for (var i = 3; --i >= 0; ) if (!J.adapter.smarter.Resolver.isFloat(tokens2.nextToken())) return false; + +if (n == 5 && !J.adapter.smarter.Resolver.isInt(tokens2.nextToken())) return false; +} +return true; +}, "~A"); +c$.checkFoldingXyz = Clazz.defineMethod(c$, "checkFoldingXyz", +function(lines){ +var tokens = new java.util.StringTokenizer(lines[0].trim(), " \t"); +if (tokens.countTokens() < 2 || !J.adapter.smarter.Resolver.isInt(tokens.nextToken().trim())) return false; +var secondLine = lines[1].trim(); +if (secondLine.length == 0) secondLine = lines[2].trim(); +tokens = new java.util.StringTokenizer(secondLine, " \t"); +return (tokens.countTokens() > 0 && J.adapter.smarter.Resolver.isInt(tokens.nextToken().trim())); +}, "~A"); +c$.checkGenNBO = Clazz.defineMethod(c$, "checkGenNBO", +function(lines, leader){ +return (leader.indexOf("$GENNBO") >= 0 || lines[1].startsWith(" Basis set information needed for plotting orbitals") || lines[1].indexOf("s in the AO basis:") >= 0 || lines[1].indexOf("***** NBO ") >= 0 || lines[2].indexOf(" N A T U R A L A T O M I C O R B I T A L") >= 0); +}, "~A,~S"); +c$.checkMol = Clazz.defineMethod(c$, "checkMol", +function(lines){ +var line4trimmed = ("X" + lines[3]).trim().toUpperCase(); +if (line4trimmed.length < 7 || line4trimmed.indexOf(".") >= 0 || lines[0].startsWith("data_")) return 0; +if (line4trimmed.endsWith("V2000")) return 2000; +if (line4trimmed.endsWith("V3000")) return 3000; +var n1 = JU.PT.parseInt(lines[3].substring(0, 3).trim()); +var n2 = JU.PT.parseInt(lines[3].substring(3, 6).trim()); +return (n1 > 0 && n2 >= 0 && lines[0].indexOf("@ ") != 0 && lines[1].indexOf("@ ") != 0 && lines[2].indexOf("@ ") != 0 ? 3 : 0); +}, "~A"); +c$.checkMopacGraphf = Clazz.defineMethod(c$, "checkMopacGraphf", +function(lines){ +return (lines[0].indexOf("MOPAC-Graphical data") > 2); +}, "~A"); +c$.checkOdyssey = Clazz.defineMethod(c$, "checkOdyssey", +function(lines){ +var i; +for (i = 0; i < lines.length; i++) if (!lines[i].startsWith("C ") && lines[i].length != 0) break; + +if (i >= lines.length || lines[i].charAt(0) != ' ' || (i = i + 2) + 1 >= lines.length) return false; +var l = lines[i]; +if (l.length < 3) return false; +var spin = JU.PT.parseInt(l.substring(2).trim()); +var charge = JU.PT.parseInt(l.substring(0, 2).trim()); +if ((l = lines[i + 1]).length < 2) return false; +var atom1 = JU.PT.parseInt(l.substring(0, 2).trim()); +if (spin < 0 || spin > 5 || atom1 <= 0 || charge == -2147483648 || charge > 5) return false; +var atomline = J.adapter.smarter.AtomSetCollectionReader.getTokensFloat(l, null, 5); +return !Float.isNaN(atomline[1]) && !Float.isNaN(atomline[2]) && !Float.isNaN(atomline[3]) && Float.isNaN(atomline[4]); +}, "~A"); +c$.checkWien2k = Clazz.defineMethod(c$, "checkWien2k", +function(lines){ +return (lines[2].startsWith("MODE OF CALC=") || lines[2].startsWith(" RELA") || lines[2].startsWith(" NREL")); +}, "~A"); +c$.checkXyz = Clazz.defineMethod(c$, "checkXyz", +function(lines){ +var checkPWM = false; +var i = JU.PT.parseInt(lines[0]); +if (i >= 0 && lines[0].trim().equals("" + i)) { +if (J.adapter.smarter.Resolver.isInt(lines[2])) return 2; +checkPWM = true; +}if (lines[0].indexOf("Bilbao Crys") >= 0) return 2; +var s; +if ((checkPWM || lines.length > 5 && i > 0) && ((s = lines[1].trim().toUpperCase()).startsWith("LATTICE VECTOR") || s.equals("LATTICE"))) return 3; +return (checkPWM ? 1 : 0); +}, "~A"); +c$.checkLineStarts = Clazz.defineMethod(c$, "checkLineStarts", +function(lines){ +for (var i = 0; i < J.adapter.smarter.Resolver.lineStartsWithRecords.length; ++i) { +var recordTags = J.adapter.smarter.Resolver.lineStartsWithRecords[i]; +for (var j = 1; j < recordTags.length; ++j) { +var recordTag = recordTags[j]; +for (var k = 0; k < lines.length; k++) { +if (lines[k].startsWith(recordTag)) return recordTags[0]; +} +} +} +return null; +}, "~A"); +c$.checkHeaderContains = Clazz.defineMethod(c$, "checkHeaderContains", +function(header){ +for (var i = 0; i < J.adapter.smarter.Resolver.headerContainsRecords.length; ++i) { +var fileType = J.adapter.smarter.Resolver.checkHeaderRecords(header, J.adapter.smarter.Resolver.headerContainsRecords[i]); +if (fileType != null) return fileType; +} +return null; +}, "~S"); +c$.checkJSONContains = Clazz.defineMethod(c$, "checkJSONContains", +function(header){ +for (var i = 0; i < J.adapter.smarter.Resolver.jsonContainsRecords.length; ++i) { +var fileType = J.adapter.smarter.Resolver.checkHeaderRecords(header, J.adapter.smarter.Resolver.jsonContainsRecords[i]); +if (fileType != null) return fileType; +} +return null; +}, "~S"); +c$.checkHeaderRecords = Clazz.defineMethod(c$, "checkHeaderRecords", +function(header, recordTags){ +for (var j = 1; j < recordTags.length; ++j) { +var recordTag = recordTags[j]; +if (header.indexOf(recordTag) < 0) continue; +var type = recordTags[0]; +if (!type.equals("Xml")) return type; +if (header.indexOf("/AFLOWDATA/") >= 0 || header.indexOf("-- Structure PRE --") >= 0) return "AFLOW"; +return (header.indexOf("= 0) ? J.adapter.smarter.Resolver.getXmlType(header) : null); +} +return null; +}, "~S,~A"); +c$.getXmlType = Clazz.defineMethod(c$, "getXmlType", +function(header){ +if (header.indexOf("http://www.molpro.net/") >= 0) { +return "XmlMolpro"; +}if (header.indexOf("odyssey") >= 0) { +return "XmlOdyssey"; +}if (header.indexOf("C3XML") >= 0) { +return "XmlChem3d"; +}if (header.indexOf("CDXML") >= 0) { +return "XmlCdx"; +}if (header.indexOf("arguslab") >= 0) { +return "XmlArgus"; +}if (header.indexOf("jvxl") >= 0 || header.indexOf("http://www.xml-cml.org/schema") >= 0 || header.indexOf("cml:") >= 0 || header.indexOf(" ") >= 0) { +return "XmlCml"; +}if (header.indexOf("XSD") >= 0) { +return "XmlXsd"; +}if (header.indexOf(">vasp") >= 0) { +return "XmlVasp"; +}if (header.indexOf(" ") >= 0) { +return "XmlQE"; +}return "XmlCml(unidentified)"; +}, "~S"); +c$.checkSpecial2 = Clazz.defineMethod(c$, "checkSpecial2", +function(lines){ +if (J.adapter.smarter.Resolver.checkGromacs(lines)) return "Gromacs"; +if (J.adapter.smarter.Resolver.checkCrystal(lines)) return "Crystal"; +if (J.adapter.smarter.Resolver.checkFAH(lines)) return "FAH"; +var s = J.adapter.smarter.Resolver.checkCastepVaspSiesta(lines); +if (s != null) return s; +return null; +}, "~A"); +c$.checkFAH = Clazz.defineMethod(c$, "checkFAH", +function(lines){ +var s = lines[0].trim() + lines[2].trim(); +return s.equals("{\"atoms\": ["); +}, "~A"); +c$.checkCrystal = Clazz.defineMethod(c$, "checkCrystal", +function(lines){ +var s = lines[1].trim(); +if (s.equals("SLAB") || s.equals("MOLECULE") || s.equals("CRYSTAL") || s.equals("POLYMER") || (s = lines[3]).equals("SLAB") || s.equals("MOLECULE") || s.equals("POLYMER")) return true; +for (var i = 0; i < lines.length; i++) { +if (lines[i].trim().equals("OPTGEOM") || lines[i].trim().equals("FREQCALC") || lines[i].contains("DOVESI") || lines[i].contains("TORINO") || lines[i].contains("http://www.crystal.unito.it") || lines[i].contains("Pcrystal") || lines[i].contains("MPPcrystal") || lines[i].contains("crystal executable")) return true; +} +return false; +}, "~A"); +c$.checkGromacs = Clazz.defineMethod(c$, "checkGromacs", +function(lines){ +if (JU.PT.parseInt(lines[1]) == -2147483648) return false; +var len = -1; +for (var i = 2; i < 16 && len != 0; i++) if ((len = lines[i].length) != 69 && len != 45 && len != 0) return false; + +return true; +}, "~A"); +c$.checkCastepVaspSiesta = Clazz.defineMethod(c$, "checkCastepVaspSiesta", +function(lines){ +for (var i = 0; i < lines.length; i++) { +var line = lines[i].toUpperCase(); +if (line.indexOf("FREQUENCIES IN CM-1") == 1 || line.contains("CASTEP") || line.startsWith("%BLOCK LATTICE_ABC") || line.startsWith("%BLOCK LATTICE_CART") || line.startsWith("%BLOCK POSITIONS_FRAC") || line.startsWith("%BLOCK POSITIONS_ABS") || line.contains("<-- E")) return "Castep"; +if (line.contains("%BLOCK")) return "Siesta"; +if (i >= 6 && i < 10 && (line.startsWith("DIRECT") || line.startsWith("CARTESIAN"))) return "VaspPoscar"; +} +return null; +}, "~A"); +c$.getFileTypefromFilter = Clazz.defineMethod(c$, "getFileTypefromFilter", +function(filter){ +var pt = (filter == null ? -1 : filter.toLowerCase().indexOf("filetype")); +return (pt < 0 ? null : filter.substring(pt + 8, (filter + ";").indexOf(";", pt)).$replace('=', ' ').trim()); +}, "~S"); +c$.fixDOSName = Clazz.defineMethod(c$, "fixDOSName", +function(fileName){ +return (fileName.indexOf(":\\") >= 0 ? fileName.$replace('\\', '/') : fileName); +}, "~S"); +c$.readerSets = Clazz.newArray(-1, ["cif.", ";Cif;Cif2;MMCif;MMTF;MagCif;BCIF;", "molxyz.", ";Mol3D;Mol;Xyz;", "more.", ";AFLOW;BinaryDcd;CDX;Gromacs;Jcampdx;MdCrd;MdTop;Mol2;TlsDataOnly;", "quantum.", ";Adf;Csf;Dgrid;GamessUK;GamessUS;Gaussian;GaussianFchk;GaussianWfn;Jaguar;Molden;MopacGraphf;GenNBO;NWChem;Psi;Qchem;QCJSON;WebMO;Orca;MO;Ams;", "pdb.", ";Pdb;Pqr;P2n;JmolData;", "pymol.", ";PyMOL;", "simple.", ";Alchemy;Ampac;Cube;FoldingXyz;GhemicalMM;HyperChem;Jme;JSON;Mopac;MopacArchive;Tinker;Input;FAH;", "spartan.", ";Spartan;SpartanSmol;Odyssey;", "xtal.", ";Abinit;Aims;Bilbao;Castep;Cgd;Crystal;Dmol;Espresso;Gulp;Jana;Magres;Shelx;Siesta;VaspOutcar;VaspPoscar;Wien2k;Xcrysden;PWmat;Optimade;Cmdf;", "xml.", ";XmlCdx;XmlArgus;XmlCml;XmlChem3d;XmlMolpro;XmlOdyssey;XmlXsd;XmlVasp;XmlQE;"]); +c$.cdxMagic = Clazz.newByteArray(-1, ['V', 'j', 'C', 'D']); +c$.cmdfMagic = Clazz.newByteArray(-1, ['C', 'M', 'D', 'F']); +c$.sptRecords = Clazz.newArray(-1, ["spt", "# Jmol state", "# Jmol script", "JmolManifest"]); +c$.m3dStartRecords = Clazz.newArray(-1, ["Alchemy", "STRUCTURE 1.00 1"]); +c$.cubeFileStartRecords = Clazz.newArray(-1, ["Cube", "JVXL", "#JVXL"]); +c$.mol2Records = Clazz.newArray(-1, ["Mol2", "mol2", "@ "]); +c$.webmoFileStartRecords = Clazz.newArray(-1, ["WebMO", "[HEADER]"]); +c$.moldenFileStartRecords = Clazz.newArray(-1, ["Molden", "[Molden", "MOLDEN", "[MOLDEN"]); +c$.dcdFileStartRecords = Clazz.newArray(-1, ["BinaryDcd", "T\0\0\0CORD", "\0\0\0TCORD"]); +c$.tlsDataOnlyFileStartRecords = Clazz.newArray(-1, ["TlsDataOnly", "REFMAC\n\nTL", "REFMAC\r\n\r\n", "REFMAC\r\rTL"]); +c$.inputFileStartRecords = Clazz.newArray(-1, ["Input", "#ZMATRIX", "%mem=", "AM1", "$rungauss"]); +c$.magresFileStartRecords = Clazz.newArray(-1, ["Magres", "#$magres", "# magres"]); +c$.pymolStartRecords = Clazz.newArray(-1, ["PyMOL", "}q"]); +c$.janaStartRecords = Clazz.newArray(-1, ["Jana", "Version Jana"]); +c$.jsonStartRecords = Clazz.newArray(-1, ["JSON", "{\"mol\":"]); +c$.jcampdxStartRecords = Clazz.newArray(-1, ["Jcampdx", "##TITLE"]); +c$.jmoldataStartRecords = Clazz.newArray(-1, ["JmolData", "REMARK 6 Jmol"]); +c$.pqrStartRecords = Clazz.newArray(-1, ["Pqr", "REMARK 1 PQR", "REMARK The B-factors"]); +c$.p2nStartRecords = Clazz.newArray(-1, ["P2n", "REMARK 1 P2N"]); +c$.cif2StartRecords = Clazz.newArray(-1, ["Cif2", "#\\#CIF_2", "\u00EF\u00BB\u00BF#\\#CIF_2"]); +c$.xmlStartRecords = Clazz.newArray(-1, ["Xml", "Bilbao Crystallographic Server<"]); +c$.xmlContainsRecords = Clazz.newArray(-1, ["Xml", "", " 0 && size <= 3 && f.startsWith("{")) { +var type = (f.contains("version\":\"DSSR") ? "dssr" : f.contains("/outliers/") ? "validation" : "domains"); +var x = vwr.parseJSONMap(f); +if (x != null) htParams.put(type, (type.equals("dssr") ? x : JS.SV.getVariableMap(x))); +continue; +}if (name.indexOf("|") >= 0) name = JU.PT.rep(name, "_", "/"); +if (i == 1) { +if (name.indexOf("/rna3dhub/") >= 0) { +s += "\n_rna3d \n;" + f + "\n;\n"; +continue; +}if (name.indexOf("/dssr/") >= 0) { +s += "\n_dssr \n;" + f + "\n;\n"; +continue; +}}s += f; +if (!s.endsWith("\n")) s += "\n"; +} +size = 1; +reader = JU.Rdr.getBR(s); +}var readers = (getReadersOnly ? new Array(size) : null); +var atomsets = (getReadersOnly ? null : new Array(size)); +var r = null; +for (var i = 0; i < size; i++) { +try { +htParams.put("vwr", vwr); +if (reader == null) reader = filesReader.getBufferedReaderOrBinaryDocument(i, false); +if (!(Clazz.instanceOf(reader,"java.io.BufferedReader") || Clazz.instanceOf(reader,"javajs.api.GenericBinaryDocument"))) return reader; +var fullPathName = names[i]; +htParams.put("fullPathName", fullPathName); +var ret = J.adapter.smarter.Resolver.getAtomCollectionReader(names[i], (types == null ? null : types[i]), reader, htParams, i); +if (!(Clazz.instanceOf(ret,"J.adapter.smarter.AtomSetCollectionReader"))) return ret; +r = ret; +r.setup(null, null, null); +if (r.isBinary) { +r.setup(names[i], htParams, filesReader.getBufferedReaderOrBinaryDocument(i, true)); +} else { +r.setup(names[i], htParams, reader); +}reader = null; +if (getReadersOnly) { +readers[i] = r; +} else { +ret = r.readData(); +if (!(Clazz.instanceOf(ret,"J.adapter.smarter.AtomSetCollection"))) return ret; +atomsets[i] = ret; +if (atomsets[i].errorMessage != null) return atomsets[i].errorMessage; +}} catch (e) { +JU.Logger.error("" + e); +e.printStackTrace(); +return "" + e; +} +} +if (getReadersOnly) return readers; +return this.getAtomSetCollectionFromSet(readers, atomsets, htParams); +}, "J.api.JmolFilesReaderInterface,~A,~A,java.util.Map,~B"); +Clazz.overrideMethod(c$, "getAtomSetCollectionFromSet", +function(readerSet, atomsets, htParams){ +var readers = readerSet; +var asc = (atomsets == null ? new Array(readers.length) : atomsets); +if (atomsets == null) { +for (var i = 0; i < readers.length; i++) { +if (readers[i] != null) try { +var ret = readers[i].readData(); +if (!(Clazz.instanceOf(ret,"J.adapter.smarter.AtomSetCollection"))) return ret; +asc[i] = ret; +if (asc[i].errorMessage != null) return asc[i].errorMessage; +} catch (e) { +JU.Logger.error("" + e); +return "" + e; +} +} +}var result; +if (htParams.containsKey("trajectorySteps")) { +result = asc[0]; +try { +if (asc.length > 1) asc[0].setInfo("ignoreUnitCell", asc[1].atomSetInfo.get("ignoreUnitCell")); +result.finalizeTrajectoryAs(htParams.get("trajectorySteps"), htParams.get("vibrationSteps")); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +if (result.errorMessage == null) result.errorMessage = "" + e; +} else { +throw e; +} +} +} else if (asc[0].isTrajectory) { +result = asc[0]; +for (var i = 1; i < asc.length; i++) asc[0].mergeTrajectories(asc[i]); + +} else { +result = (asc.length == 1 ? asc[0] : new J.adapter.smarter.AtomSetCollection("Array", null, asc, null)); +}return (result.errorMessage == null ? result : result.errorMessage); +}, "~O,~O,java.util.Map"); +Clazz.overrideMethod(c$, "getAtomSetCollectionFromDOM", +function(DOMNode, htParams){ +throw new UnsupportedOperationException(); +}, "~O,java.util.Map"); +Clazz.overrideMethod(c$, "finish", +function(asc){ +(asc).finish(); +}, "~O"); +Clazz.overrideMethod(c$, "getAtomSetCollectionName", +function(asc){ +return (asc).collectionName; +}, "~O"); +Clazz.overrideMethod(c$, "getAtomSetCollectionAuxiliaryInfo", +function(asc){ +return (asc).atomSetInfo; +}, "~O"); +Clazz.overrideMethod(c$, "getAtomSetCount", +function(asc){ +return (asc).atomSetCount; +}, "~O"); +Clazz.overrideMethod(c$, "getAtomSetNumber", +function(asc, atomSetIndex){ +return (asc).getAtomSetNumber(atomSetIndex); +}, "~O,~N"); +Clazz.overrideMethod(c$, "getAtomSetName", +function(asc, atomSetIndex){ +return (asc).getAtomSetName(atomSetIndex); +}, "~O,~N"); +Clazz.overrideMethod(c$, "getAtomSetAuxiliaryInfo", +function(asc, atomSetIndex){ +return (asc).getAtomSetAuxiliaryInfo(atomSetIndex); +}, "~O,~N"); +Clazz.overrideMethod(c$, "getHydrogenAtomCount", +function(asc){ +return (asc).getHydrogenAtomCount(); +}, "~O"); +Clazz.overrideMethod(c$, "getBondList", +function(asc){ +return (asc).getBondList(); +}, "~O"); +Clazz.overrideMethod(c$, "getAtomCount", +function(asc, atomSetIndex){ +var a = asc; +if (atomSetIndex < 0) return (a.bsAtoms == null ? a.ac : a.bsAtoms.cardinality()); +if (a.bsAtoms == null) return a.getAtomSetAtomCount(atomSetIndex); +var b = JU.BSUtil.copy(a.bsAtoms); +var i0 = a.getAtomSetAtomIndex(atomSetIndex); +b.and(JU.BSUtil.newBitSet2(i0, i0 + a.getAtomSetAtomCount(atomSetIndex))); +return b.cardinality(); +}, "~O,~N"); +Clazz.overrideMethod(c$, "coordinatesAreFractional", +function(asc){ +return (asc).coordinatesAreFractional; +}, "~O"); +Clazz.overrideMethod(c$, "getAtomIterator", +function(asc){ +return new J.adapter.smarter.AtomIterator(asc); +}, "~O"); +Clazz.overrideMethod(c$, "getBondIterator", +function(asc){ +return ((asc).bondCount == 0 ? null : new J.adapter.smarter.BondIterator(asc)); +}, "~O"); +Clazz.overrideMethod(c$, "getStructureIterator", +function(asc){ +return (asc).structureCount == 0 ? null : new J.adapter.smarter.StructureIterator(asc); +}, "~O"); +c$.close = Clazz.defineMethod(c$, "close", +function(bufferedReader){ +if (Clazz.instanceOf(bufferedReader,"java.io.BufferedReader")) (bufferedReader).close(); + else (bufferedReader).close(); +}, "~O"); +c$.PATH_SEPARATOR = System.getProperty("path.separator", "/"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/Structure.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/Structure.js new file mode 100755 index 000000000000..35228b9fc847 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/Structure.js @@ -0,0 +1,74 @@ +Clazz.declarePackage("J.adapter.smarter"); +Clazz.load(null, "J.adapter.smarter.Structure", ["J.c.STR"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.structureType = null; +this.substructureType = null; +this.structureID = null; +this.strandID = null; +this.strandCount = 0; +this.startSequenceNumber = 0; +this.startChainID = 0; +this.startInsertionCode = '\0'; +this.endSequenceNumber = 0; +this.endChainID = 0; +this.endInsertionCode = '\0'; +this.atomStartEnd = null; +this.modelStartEnd = null; +this.bsAll = null; +Clazz.instantialize(this, arguments);}, J.adapter.smarter, "Structure", null, Cloneable); +Clazz.prepareFields (c$, function(){ +this.atomStartEnd = Clazz.newIntArray (2, 0); +this.modelStartEnd = Clazz.newIntArray(-1, [-1, -1]); +}); +Clazz.makeConstructor(c$, +function(modelIndex, structureType, substructureType, structureID, strandID, strandCount, bsAll){ +if (bsAll != null) { +this.modelStartEnd = Clazz.newIntArray(-1, [0, modelIndex]); +this.bsAll = bsAll; +return; +}this.structureType = structureType; +this.substructureType = substructureType; +if (structureID == null) return; +this.modelStartEnd[0] = this.modelStartEnd[1] = modelIndex; +this.structureID = structureID; +this.strandCount = strandCount; +this.strandID = strandID; +}, "~N,J.c.STR,J.c.STR,~S,~S,~N,~A"); +c$.getHelixType = Clazz.defineMethod(c$, "getHelixType", +function(type){ +switch (type) { +case 1: +return J.c.STR.HELIXALPHA; +case 3: +return J.c.STR.HELIXPI; +case 5: +return J.c.STR.HELIX310; +} +return J.c.STR.HELIX; +}, "~N"); +Clazz.defineMethod(c$, "set", +function(startChainID, startSequenceNumber, startInsertionCode, endChainID, endSequenceNumber, endInsertionCode, istart, iend){ +this.startChainID = startChainID; +this.startSequenceNumber = startSequenceNumber; +this.startInsertionCode = startInsertionCode; +this.endChainID = endChainID; +this.endSequenceNumber = endSequenceNumber; +this.endInsertionCode = endInsertionCode; +this.atomStartEnd[0] = istart; +this.atomStartEnd[1] = iend; +}, "~N,~N,~S,~N,~N,~S,~N,~N"); +Clazz.defineMethod(c$, "clone", +function(){ +var s = null; +try { +s = Clazz.superCall(this, J.adapter.smarter.Structure, "clone", []); +} catch (e) { +if (Clazz.exceptionOf(e,"CloneNotSupportedException")){ +} else { +throw e; +} +} +return s; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/StructureIterator.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/StructureIterator.js new file mode 100755 index 000000000000..f14bf0331cd7 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/StructureIterator.js @@ -0,0 +1,85 @@ +Clazz.declarePackage("J.adapter.smarter"); +Clazz.load(["J.api.JmolAdapterStructureIterator"], "J.adapter.smarter.StructureIterator", ["J.api.JmolAdapter"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.structureCount = 0; +this.structures = null; +this.structure = null; +this.istructure = 0; +this.bsModelsDefined = null; +Clazz.instantialize(this, arguments);}, J.adapter.smarter, "StructureIterator", J.api.JmolAdapterStructureIterator); +Clazz.makeConstructor(c$, +function(asc){ +Clazz.superConstructor (this, J.adapter.smarter.StructureIterator, []); +this.structureCount = asc.structureCount; +this.structures = asc.structures; +this.istructure = 0; +this.bsModelsDefined = asc.bsStructuredModels; +}, "J.adapter.smarter.AtomSetCollection"); +Clazz.overrideMethod(c$, "hasNext", +function(){ +if (this.istructure == this.structureCount) return false; +this.structure = this.structures[this.istructure++]; +return true; +}); +Clazz.overrideMethod(c$, "getStructureType", +function(){ +return this.structure.structureType; +}); +Clazz.overrideMethod(c$, "getSubstructureType", +function(){ +return this.structure.substructureType; +}); +Clazz.overrideMethod(c$, "getStructureID", +function(){ +return this.structure.structureID; +}); +Clazz.overrideMethod(c$, "getStrandID", +function(){ +return this.structure.strandID; +}); +Clazz.overrideMethod(c$, "getStartChainID", +function(){ +return this.structure.startChainID; +}); +Clazz.overrideMethod(c$, "getStartSequenceNumber", +function(){ +return this.structure.startSequenceNumber; +}); +Clazz.overrideMethod(c$, "getStartInsertionCode", +function(){ +return J.api.JmolAdapter.canonizeInsertionCode(this.structure.startInsertionCode); +}); +Clazz.overrideMethod(c$, "getEndChainID", +function(){ +return this.structure.endChainID; +}); +Clazz.overrideMethod(c$, "getEndSequenceNumber", +function(){ +return this.structure.endSequenceNumber; +}); +Clazz.overrideMethod(c$, "getEndInsertionCode", +function(){ +return this.structure.endInsertionCode; +}); +Clazz.overrideMethod(c$, "getStrandCount", +function(){ +return this.structure.strandCount; +}); +Clazz.overrideMethod(c$, "getStructuredModels", +function(){ +return this.bsModelsDefined; +}); +Clazz.overrideMethod(c$, "getAtomIndices", +function(){ +return this.structure.atomStartEnd; +}); +Clazz.overrideMethod(c$, "getModelIndices", +function(){ +return this.structure.modelStartEnd; +}); +Clazz.overrideMethod(c$, "getBSAll", +function(){ +return this.structure.bsAll; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/XtalSymmetry.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/XtalSymmetry.js new file mode 100755 index 000000000000..ce3990a49d03 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/smarter/XtalSymmetry.js @@ -0,0 +1,1162 @@ +Clazz.declarePackage("J.adapter.smarter"); +Clazz.load(["JS.Symmetry", "JU.P3", "$.SB"], "J.adapter.smarter.XtalSymmetry", ["java.util.Hashtable", "JU.BS", "$.Lst", "$.M3", "$.M4", "$.P3i", "$.PT", "$.V3", "J.adapter.smarter.Atom", "JS.SpaceGroup", "$.SymmetryOperation", "$.UnitCell", "JU.BSUtil", "$.Logger", "$.SimpleUnitCell"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.acr = null; +this.applySymmetryToBonds = false; +this.asc = null; +this.baseSymmetry = null; +this.bondCount0 = 0; +this.bondsFound = null; +this.centroidPacked = false; +this.checkAll = false; +this.checkNearAtoms = false; +this.crystalReaderLatticeOpsOnly = false; +this.disorderMap = null; +this.disorderMapMax = 0; +this.doCentroidUnitCell = false; +this.doNormalize = true; +this.doPackUnitCell = false; +this.filterSymop = null; +this.firstAtom = 0; +this.latticeCells = null; +this.latticeOp = 0; +this.mident = null; +this.minXYZ = null; +this.maxXYZ = null; +this.minXYZ0 = null; +this.maxXYZ0 = null; +this.mTemp = null; +this.ndims = 3; +this.noSymmetryCount = 0; +this.nVib = 0; +this.packingRange = 0; +this.ptOffset = null; +this.ptTemp = null; +this.rminx = 0; +this.rminy = 0; +this.rminz = 0; +this.rmaxx = 0; +this.rmaxy = 0; +this.rmaxz = 0; +this.symmetry = null; +this.symmetryRange = 0; +this.trajectoryUnitCells = null; +this.unitCellParams = null; +this.unitCellTranslations = null; +Clazz.instantialize(this, arguments);}, J.adapter.smarter, "XtalSymmetry", null); +Clazz.prepareFields (c$, function(){ +this.bondsFound = new JU.SB(); +this.ptOffset = new JU.P3(); +}); +Clazz.makeConstructor(c$, +function(){ +}); +Clazz.defineMethod(c$, "addRotatedTensor", +function(a, t, iSym, reset, symmetry){ +if (this.ptTemp == null) { +this.ptTemp = new JU.P3(); +this.mTemp = new JU.M3(); +}return a.addTensor((this.acr.getInterface("JU.Tensor")).setFromEigenVectors(symmetry.rotateAxes(iSym, t.eigenVectors, this.ptTemp, this.mTemp), t.eigenValues, t.isIsotropic ? "iso" : t.type, t.id, t), null, reset); +}, "J.adapter.smarter.Atom,JU.Tensor,~N,~B,J.adapter.smarter.XtalSymmetry.FileSymmetry"); +Clazz.defineMethod(c$, "applySymmetryBio", +function(thisBiomolecule, applySymmetryToBonds, filter){ +var biomts = thisBiomolecule.get("biomts"); +var len = biomts.size(); +if (this.mident == null) { +this.mident = new JU.M4(); +this.mident.setIdentity(); +}this.acr.lstNCS = null; +this.setLatticeCells(); +var lc = (this.latticeCells != null && this.latticeCells[0] != 0 ? Clazz.newIntArray (3, 0) : null); +if (lc != null) for (var i = 0; i < 3; i++) lc[i] = this.latticeCells[i]; + +this.latticeCells = null; +var bmChains = this.acr.getFilterWithCase("BMCHAINS"); +var fixBMChains = (bmChains == null ? -1 : bmChains.length < 2 ? 0 : JU.PT.parseInt(bmChains.substring(1))); +if (fixBMChains == -2147483648) { +fixBMChains = -(bmChains.charAt(1)).charCodeAt(0); +}var particleMode = (filter.indexOf("BYCHAIN") >= 0 ? 1 : filter.indexOf("BYSYMOP") >= 0 ? 2 : 0); +this.doNormalize = false; +var biomtchains = thisBiomolecule.get("chains"); +(this.symmetry = new J.adapter.smarter.XtalSymmetry.FileSymmetry()).setSpaceGroup(this.doNormalize); +this.addSpaceGroupOperation("x,y,z", false); +var name = thisBiomolecule.get("name"); +this.setAtomSetSpaceGroupName(this.acr.sgName = name); +this.applySymmetryToBonds = applySymmetryToBonds; +this.bondCount0 = this.asc.bondCount; +this.firstAtom = this.asc.getLastAtomSetAtomIndex(); +var atomMax = this.asc.ac; +var ht = new java.util.Hashtable(); +var nChain = 0; +var atoms = this.asc.atoms; +var addBonds = (this.bondCount0 > this.asc.bondIndex0 && applySymmetryToBonds); +switch (particleMode) { +case 1: +for (var i = atomMax; --i >= this.firstAtom; ) { +var id = Integer.$valueOf(atoms[i].chainID); +var bs = ht.get(id); +if (bs == null) { +nChain++; +ht.put(id, bs = new JU.BS()); +}bs.set(i); +} +this.asc.bsAtoms = new JU.BS(); +for (var i = 0; i < nChain; i++) { +this.asc.bsAtoms.set(atomMax + i); +var a = new J.adapter.smarter.Atom(); +a.set(0, 0, 0); +a.radius = 16; +this.asc.addAtom(a); +} +var ichain = 0; +for (var e, $e = ht.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) { +var a = atoms[atomMax + ichain++]; +var bs = e.getValue(); +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) a.add(atoms[i]); + +a.scale(1 / bs.cardinality()); +a.atomName = "Pt" + ichain; +a.chainID = e.getKey().intValue(); +} +this.firstAtom = atomMax; +atomMax += nChain; +addBonds = false; +break; +case 2: +this.asc.bsAtoms = new JU.BS(); +this.asc.bsAtoms.set(atomMax); +var a = atoms[atomMax] = new J.adapter.smarter.Atom(); +a.set(0, 0, 0); +for (var i = atomMax; --i >= this.firstAtom; ) a.add(atoms[i]); + +a.scale(1 / (atomMax - this.firstAtom)); +a.atomName = "Pt"; +a.radius = 16; +this.asc.addAtom(a); +this.firstAtom = atomMax++; +addBonds = false; +break; +} +var assemblyIdAtoms = thisBiomolecule.get("asemblyIdAtoms"); +if (filter.indexOf("#<") >= 0) { +len = Math.min(len, JU.PT.parseInt(filter.substring(filter.indexOf("#<") + 2)) - 1); +filter = JU.PT.rep(filter, "#<", "_<"); +}var maxChain = 0; +for (var iAtom = this.firstAtom; iAtom < atomMax; iAtom++) { +atoms[iAtom].bsSymmetry = new JU.BS(); +var chainID = atoms[iAtom].chainID; +if (chainID > maxChain) maxChain = chainID; +} +var bsAtoms = this.asc.bsAtoms; +var atomMap = (addBonds ? Clazz.newIntArray (this.asc.ac, 0) : null); +for (var imt = (biomtchains == null ? 1 : 0); imt < len; imt++) { +if (filter.indexOf("!#") >= 0) { +if (filter.indexOf("!#" + (imt + 1) + ";") >= 0) continue; +} else if (filter.indexOf("#") >= 0 && filter.indexOf("#" + (imt + 1) + ";") < 0) { +continue; +}var mat = biomts.get(imt); +var notIdentity = !mat.equals(this.mident); +var chains = (biomtchains == null ? null : biomtchains.get(imt)); +if (chains != null && assemblyIdAtoms != null) { +bsAtoms = new JU.BS(); +for (var e, $e = assemblyIdAtoms.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) if (chains.indexOf(":" + e.getKey() + ";") >= 0) bsAtoms.or(e.getValue()); + +if (this.asc.bsAtoms != null) bsAtoms.and(this.asc.bsAtoms); +chains = null; +}var lastID = -1; +var id; +var skipping = false; +for (var iAtom = this.firstAtom; iAtom < atomMax; iAtom++) { +if (bsAtoms != null) { +skipping = !bsAtoms.get(iAtom); +} else if (chains != null && (id = atoms[iAtom].chainID) != lastID) { +skipping = (chains.indexOf(":" + this.acr.vwr.getChainIDStr(lastID = id) + ";") < 0); +}if (skipping) continue; +try { +var atomSite = atoms[iAtom].atomSite; +var atom1; +if (addBonds) atomMap[atomSite] = this.asc.ac; +atom1 = this.asc.newCloneAtom(atoms[iAtom]); +atom1.bondingRadius = imt; +this.asc.atomSymbolicMap.put("" + atom1.atomSerial, atom1); +if (this.asc.bsAtoms != null) this.asc.bsAtoms.set(atom1.index); +atom1.atomSite = atomSite; +if (notIdentity) mat.rotTrans(atom1); +atom1.bsSymmetry = JU.BSUtil.newAndSetBit(imt); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +this.asc.errorMessage = "appendAtomCollection error: " + e; +} else { +throw e; +} +} +} +if (notIdentity) this.symmetry.addBioMoleculeOperation(mat, false); +if (addBonds) { +for (var bondNum = this.asc.bondIndex0; bondNum < this.bondCount0; bondNum++) { +var bond = this.asc.bonds[bondNum]; +var iAtom1 = atomMap[atoms[bond.atomIndex1].atomSite]; +var iAtom2 = atomMap[atoms[bond.atomIndex2].atomSite]; +this.asc.addNewBondWithOrder(iAtom1, iAtom2, bond.order); +} +}} +if (biomtchains != null) { +if (this.asc.bsAtoms == null) this.asc.bsAtoms = JU.BSUtil.newBitSet2(0, this.asc.ac); +this.asc.bsAtoms.clearBits(this.firstAtom, atomMax); +if (particleMode == 0) { +if (fixBMChains != -1) { +var assignABC = (fixBMChains != 0); +var bsChains = (assignABC ? new JU.BS() : null); +atoms = this.asc.atoms; +var firstNew = 0; +if (assignABC) { +firstNew = (fixBMChains < 0 ? Math.max(-fixBMChains, maxChain + 1) : Math.max(maxChain + fixBMChains, 65)); +bsChains.setBits(0, firstNew - 1); +bsChains.setBits(91, 97); +bsChains.setBits(123, 200); +}var bsAll = (this.asc.structureCount == 1 ? this.asc.structures[0].bsAll : null); +var chainMap = new java.util.Hashtable(); +var knownMap = new java.util.Hashtable(); +var knownAtomMap = (bsAll == null ? null : new java.util.Hashtable()); +var lastKnownAtom = null; +for (var i = atomMax, n = this.asc.ac; i < n; i++) { +var ic = atoms[i].chainID; +var isym = atoms[i].bsSymmetry.nextSetBit(0); +var ch0 = this.acr.vwr.getChainIDStr(ic); +var ch = (isym == 0 ? ch0 : ch0 + isym); +var known = chainMap.get(ch); +if (known == null) { +if (assignABC && isym != 0) { +var pt = (firstNew < 200 ? bsChains.nextClearBit(firstNew) : 200); +if (pt < 200) { +bsChains.set(pt); +known = Integer.$valueOf(this.acr.vwr.getChainID("" + String.fromCharCode(pt), true)); +firstNew = pt; +} else { +}}if (known == null) known = Integer.$valueOf(this.acr.vwr.getChainID(ch, true)); +if (ch !== ch0) { +knownMap.put(known, Integer.$valueOf(ic)); +if (bsAll != null) { +if (lastKnownAtom != null) lastKnownAtom[1] = i; +knownAtomMap.put(known, lastKnownAtom = Clazz.newIntArray(-1, [i, n])); +}}chainMap.put(ch, known); +}atoms[i].chainID = known.intValue(); +} +if (this.asc.structureCount > 0) { +var strucs = this.asc.structures; +var nStruc = this.asc.structureCount; +for (var e, $e = knownMap.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) { +var known = e.getKey(); +var ch1 = known.intValue(); +var ch0 = e.getValue().intValue(); +for (var i = 0; i < nStruc; i++) { +var s = strucs[i]; +if (s.bsAll != null) { +} else if (s.startChainID == s.endChainID) { +if (s.startChainID == ch0) { +var s1 = s.clone(); +s1.startChainID = s1.endChainID = ch1; +this.asc.addStructure(s1); +}} else { +System.err.println("XtalSymmetry not processing biomt chain structure " + this.acr.vwr.getChainIDStr(ch0) + " to " + this.acr.vwr.getChainIDStr(ch1)); +}} +} +}}var vConnect = this.asc.getAtomSetAuxiliaryInfoValue(-1, "PDB_CONECT_bonds"); +if (!addBonds && vConnect != null) { +for (var i = vConnect.size(); --i >= 0; ) { +var bond = vConnect.get(i); +var a = this.asc.getAtomFromName("" + bond[0]); +var b = this.asc.getAtomFromName("" + bond[1]); +if (a != null && b != null && a.bondingRadius != b.bondingRadius && (bsAtoms == null || bsAtoms.get(a.index) && bsAtoms.get(b.index)) && a.distanceSquared(b) > 25.0) { +vConnect.removeItemAt(i); +System.out.println("long interchain bond removed for @" + a.atomSerial + "-@" + b.atomSerial); +}} +}}for (var i = atomMax, n = this.asc.ac; i < n; i++) { +this.asc.atoms[i].bondingRadius = NaN; +} +}this.noSymmetryCount = atomMax - this.firstAtom; +this.finalizeSymmetry(this.symmetry); +this.setCurrentModelInfo(len, null, null); +this.reset(); +}, "java.util.Map,~B,~S"); +Clazz.defineMethod(c$, "getBaseSymmetry", +function(){ +return (this.baseSymmetry == null ? this.symmetry : this.baseSymmetry); +}); +Clazz.defineMethod(c$, "getOverallSpan", +function(){ +return (this.maxXYZ0 == null ? JU.V3.new3(this.maxXYZ.x - this.minXYZ.x, this.maxXYZ.y - this.minXYZ.y, this.maxXYZ.z - this.minXYZ.z) : JU.V3.newVsub(this.maxXYZ0, this.minXYZ0)); +}); +Clazz.defineMethod(c$, "getSymmetry", +function(){ +return (this.symmetry == null ? (this.symmetry = new J.adapter.smarter.XtalSymmetry.FileSymmetry()) : this.symmetry); +}); +Clazz.defineMethod(c$, "isWithinCell", +function(ndims, pt, minX, maxX, minY, maxY, minZ, maxZ, slop){ +return (pt.x > minX - slop && pt.x < maxX + slop && (ndims < 2 || pt.y > minY - slop && pt.y < maxY + slop) && (ndims < 3 || pt.z > minZ - slop && pt.z < maxZ + slop)); +}, "~N,JU.P3,~N,~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "scaleFractionalVibs", +function(){ +var params = this.acr.unitCellParams; +var ptScale = JU.P3.new3(1 / params[0], 1 / params[1], 1 / params[2]); +var i0 = this.asc.getAtomSetAtomIndex(this.asc.iSet); +for (var i = this.asc.ac; --i >= i0; ) { +var v = this.asc.atoms[i].vib; +if (v != null) { +v.scaleT(ptScale); +}} +}); +Clazz.defineMethod(c$, "set", +function(reader){ +this.acr = reader; +this.asc = reader.asc; +this.getSymmetry(); +return this; +}, "J.adapter.smarter.AtomSetCollectionReader"); +Clazz.defineMethod(c$, "setLatticeParameter", +function(latt){ +this.symmetry.setSpaceGroup(this.doNormalize); +this.symmetry.setLattice(latt); +}, "~N"); +Clazz.defineMethod(c$, "setSpinVectors", +function(){ +if (this.nVib > 0 || this.asc.iSet < 0 || !this.acr.vibsFractional) return this.nVib; +var i0 = this.asc.getAtomSetAtomIndex(this.asc.iSet); +var sym = this.getBaseSymmetry(); +for (var i = this.asc.ac; --i >= i0; ) { +var v = this.asc.atoms[i].vib; +if (v != null) { +if (v.modDim > 0) { +(v).setMoment(); +} else { +v = v.clone(); +sym.toCartesian(v, true); +this.asc.atoms[i].vib = v; +}this.nVib++; +}} +return this.nVib; +}); +Clazz.defineMethod(c$, "addSpaceGroupOperation", +function(xyz, andSetLattice){ +this.symmetry.setSpaceGroup(this.doNormalize); +if (andSetLattice && this.symmetry.getSpaceGroupOperationCount() == 1) this.setLatticeCells(); +return this.symmetry.addSpaceGroupOperation(xyz, 0); +}, "~S,~B"); +Clazz.defineMethod(c$, "applySymmetryFromReader", +function(readerSymmetry){ +this.asc.setCoordinatesAreFractional(this.acr.iHaveFractionalCoordinates); +this.setAtomSetSpaceGroupName(this.acr.sgName); +this.symmetryRange = this.acr.symmetryRange; +this.asc.setInfo("symmetryRange", Float.$valueOf(this.symmetryRange)); +if (this.acr.doConvertToFractional || this.acr.fileCoordinatesAreFractional) { +this.setLatticeCells(); +var doApplySymmetry = true; +if (this.acr.ignoreFileSpaceGroupName || !this.acr.iHaveSymmetryOperators) { +if (this.acr.unitCellParams[0] == 0 && this.acr.unitCellParams[2] == 0) { +JU.SimpleUnitCell.fillParams(null, null, null, this.acr.unitCellParams); +}if (!this.acr.merging || readerSymmetry == null) readerSymmetry = new J.adapter.smarter.XtalSymmetry.FileSymmetry(); +doApplySymmetry = readerSymmetry.createSpaceGroup(this.acr.desiredSpaceGroupIndex, (this.acr.sgName.indexOf("!") >= 0 ? "P1" : this.acr.sgName), this.acr.unitCellParams, this.acr.modDim); +} else { +this.acr.doPreSymmetry(); +readerSymmetry = null; +}this.packingRange = this.acr.getPackingRangeValue(0); +if (doApplySymmetry) { +if (readerSymmetry != null) this.getSymmetry().setSpaceGroupTo(readerSymmetry.getSpaceGroup()); +this.applySymmetryLattice(); +if (readerSymmetry != null && this.filterSymop == null) this.setAtomSetSpaceGroupName(readerSymmetry.getSpaceGroupName()); +} else { +this.setUnitCellSafely(); +}}if (this.acr.iHaveFractionalCoordinates && this.acr.merging && readerSymmetry != null) { +var atoms = this.asc.atoms; +for (var i = this.asc.getLastAtomSetAtomIndex(), n = this.asc.ac; i < n; i++) readerSymmetry.toCartesian(atoms[i], true); + +this.asc.setCoordinatesAreFractional(false); +this.acr.addVibrations = false; +}return this.symmetry; +}, "J.adapter.smarter.XtalSymmetry.FileSymmetry"); +Clazz.defineMethod(c$, "setSymmetry", +function(symmetry){ +return (this.symmetry = symmetry); +}, "J.adapter.smarter.XtalSymmetry.FileSymmetry"); +Clazz.defineMethod(c$, "setTensors", +function(){ +var n = this.asc.ac; +for (var i = this.asc.getLastAtomSetAtomIndex(); i < n; i++) { +var a = this.asc.atoms[i]; +if (a.anisoBorU == null) continue; +a.addTensor(this.symmetry.getTensor(this.acr.vwr, a.anisoBorU), null, false); +if (Float.isNaN(a.bfactor)) a.bfactor = a.anisoBorU[7] * 100; +a.anisoBorU = null; +} +}); +Clazz.defineMethod(c$, "adjustRangeMinMax", +function(oabc){ +var pa = new JU.P3(); +var pb = new JU.P3(); +var pc = new JU.P3(); +if (this.acr.forcePacked) { +pa.setT(oabc[1]); +pb.setT(oabc[2]); +pc.setT(oabc[3]); +pa.scale(this.packingRange); +pb.scale(this.packingRange); +pc.scale(this.packingRange); +}oabc[0].scaleAdd2(this.minXYZ.x, oabc[1], oabc[0]); +oabc[0].scaleAdd2(this.minXYZ.y, oabc[2], oabc[0]); +oabc[0].scaleAdd2(this.minXYZ.z, oabc[3], oabc[0]); +oabc[0].sub(pa); +oabc[0].sub(pb); +oabc[0].sub(pc); +var pt = JU.P3.newP(oabc[0]); +this.symmetry.toFractional(pt, true); +this.setSymmetryMinMax(pt); +oabc[1].scale(this.maxXYZ.x - this.minXYZ.x); +oabc[2].scale(this.maxXYZ.y - this.minXYZ.y); +oabc[3].scale(this.maxXYZ.z - this.minXYZ.z); +oabc[1].scaleAdd2(2, pa, oabc[1]); +oabc[2].scaleAdd2(2, pb, oabc[2]); +oabc[3].scaleAdd2(2, pc, oabc[3]); +for (var i = 0; i < 3; i++) { +for (var j = i + 1; j < 4; j++) { +pt.add2(oabc[i], oabc[j]); +if (i != 0) pt.add(oabc[0]); +this.symmetry.toFractional(pt, false); +this.setSymmetryMinMax(pt); +} +} +this.symmetry.toCartesian(pt, false); +pt.add(oabc[1]); +this.symmetry.toFractional(pt, false); +this.setSymmetryMinMax(pt); +this.minXYZ = JU.P3i.new3(Clazz.doubleToInt(Math.min(0, Math.floor(this.rminx + 0.001))), Clazz.doubleToInt(Math.min(0, Math.floor(this.rminy + 0.001))), Clazz.doubleToInt(Math.min(0, Math.floor(this.rminz + 0.001)))); +this.maxXYZ = JU.P3i.new3(Clazz.doubleToInt(Math.max(1, Math.ceil(this.rmaxx - 0.001))), Clazz.doubleToInt(Math.max(1, Math.ceil(this.rmaxy - 0.001))), Clazz.doubleToInt(Math.max(1, Math.ceil(this.rmaxz - 0.001)))); +}, "~A"); +Clazz.defineMethod(c$, "applyAllSymmetry", +function(ms, bsAtoms){ +if (this.asc.ac == 0 || bsAtoms != null && bsAtoms.isEmpty()) return; +var n = this.noSymmetryCount = this.asc.baseSymmetryAtomCount > 0 ? this.asc.baseSymmetryAtomCount : bsAtoms == null ? this.asc.getLastAtomSetAtomCount() : this.asc.ac - bsAtoms.nextSetBit(this.asc.getLastAtomSetAtomIndex()); +this.asc.setTensors(); +this.applySymmetryToBonds = this.acr.applySymmetryToBonds; +this.doPackUnitCell = this.acr.doPackUnitCell && !this.applySymmetryToBonds; +this.bondCount0 = this.asc.bondCount; +this.ndims = JU.SimpleUnitCell.getDimensionFromParams(this.acr.unitCellParams); +this.finalizeSymmetry(this.symmetry); +var operationCount = this.symmetry.getSpaceGroupOperationCount(); +var excludedOps = (this.acr.thisBiomolecule == null ? null : new JU.BS()); +this.checkNearAtoms = this.acr.checkNearAtoms || excludedOps != null; +JU.SimpleUnitCell.setMinMaxLatticeParameters(this.ndims, this.minXYZ, this.maxXYZ, 0); +this.latticeOp = this.symmetry.getLatticeOp(); +this.crystalReaderLatticeOpsOnly = (this.asc.crystalReaderLatticeOpsOnly && this.latticeOp >= 0); +if (this.doCentroidUnitCell) this.asc.setInfo("centroidMinMax", Clazz.newIntArray(-1, [this.minXYZ.x, this.minXYZ.y, this.minXYZ.z, this.maxXYZ.x, this.maxXYZ.y, this.maxXYZ.z, (this.centroidPacked ? 1 : 0)])); +if (this.doCentroidUnitCell || this.acr.doPackUnitCell || this.symmetryRange != 0 && this.maxXYZ.x - this.minXYZ.x == 1 && this.maxXYZ.y - this.minXYZ.y == 1 && this.maxXYZ.z - this.minXYZ.z == 1) { +this.minXYZ0 = JU.P3.new3(this.minXYZ.x, this.minXYZ.y, this.minXYZ.z); +this.maxXYZ0 = JU.P3.new3(this.maxXYZ.x, this.maxXYZ.y, this.maxXYZ.z); +if (ms != null) { +ms.setMinMax0(this.minXYZ0, this.maxXYZ0); +this.minXYZ.set(Clazz.floatToInt(this.minXYZ0.x), Clazz.floatToInt(this.minXYZ0.y), Clazz.floatToInt(this.minXYZ0.z)); +this.maxXYZ.set(Clazz.floatToInt(this.maxXYZ0.x), Clazz.floatToInt(this.maxXYZ0.y), Clazz.floatToInt(this.maxXYZ0.z)); +}switch (this.ndims) { +case 3: +this.minXYZ.z--; +this.maxXYZ.z++; +case 2: +this.minXYZ.y--; +this.maxXYZ.y++; +case 1: +this.minXYZ.x--; +this.maxXYZ.x++; +} +}var nCells = (this.maxXYZ.x - this.minXYZ.x) * (this.maxXYZ.y - this.minXYZ.y) * (this.maxXYZ.z - this.minXYZ.z); +var nsym = n * (this.crystalReaderLatticeOpsOnly ? 4 : operationCount); +var cartesianCount = (this.checkNearAtoms || this.acr.thisBiomolecule != null ? nsym * nCells : this.symmetryRange > 0 ? nsym : 1); +var cartesians = new Array(cartesianCount); +var atoms = this.asc.atoms; +for (var i = 0; i < n; i++) atoms[this.firstAtom + i].bsSymmetry = JU.BS.newN(operationCount * (nCells + 1)); + +var pt = 0; +this.unitCellTranslations = new Array(nCells); +var iCell = 0; +var cell555Count = 0; +var absRange = Math.abs(this.symmetryRange); +var checkCartesianRange = (this.symmetryRange != 0); +var checkRangeNoSymmetry = (this.symmetryRange < 0); +var checkRange111 = (this.symmetryRange > 0); +if (checkCartesianRange) { +this.rminx = this.rminy = this.rminz = 3.4028235E38; +this.rmaxx = this.rmaxy = this.rmaxz = -3.4028235E38; +}var sym = this.symmetry; +var lastSymmetry = sym; +this.checkAll = (this.crystalReaderLatticeOpsOnly || this.asc.atomSetCount == 1 && this.checkNearAtoms && this.latticeOp >= 0); +var lstNCS = this.acr.lstNCS; +if (lstNCS != null && lstNCS.get(0).m33 == 0) { +var nOp = sym.getSpaceGroupOperationCount(); +var nn = lstNCS.size(); +for (var i = nn; --i >= 0; ) { +var m = lstNCS.get(i); +m.m33 = 1; +sym.toFractionalM(m); +} +for (var i = 1; i < nOp; i++) { +var m1 = sym.getSpaceGroupOperation(i); +for (var j = 0; j < nn; j++) { +var m = JU.M4.newM4(lstNCS.get(j)); +m.mul2(m1, m); +if (this.doNormalize && this.noSymmetryCount > 0) JS.SymmetryOperation.normalizeOperationToCentroid(3, m, atoms, this.firstAtom, this.noSymmetryCount); +lstNCS.addLast(m); +} +} +}var pttemp = null; +var op = sym.getSpaceGroupOperation(0); +if (this.doPackUnitCell) { +pttemp = new JU.P3(); +this.ptOffset.set(0, 0, 0); +}var atomMap = (this.bondCount0 > this.asc.bondIndex0 && this.applySymmetryToBonds ? Clazz.newIntArray (n, 0) : null); +var unitCells = Clazz.newIntArray (nCells, 0); +for (var tx = this.minXYZ.x; tx < this.maxXYZ.x; tx++) { +for (var ty = this.minXYZ.y; ty < this.maxXYZ.y; ty++) { +for (var tz = this.minXYZ.z; tz < this.maxXYZ.z; tz++) { +this.unitCellTranslations[iCell] = JU.V3.new3(tx, ty, tz); +unitCells[iCell++] = 555 + tx * 100 + ty * 10 + tz; +if (tx != 0 || ty != 0 || tz != 0 || cartesians.length == 0) continue; +for (pt = 0; pt < n; pt++) { +var atom = atoms[this.firstAtom + pt]; +if (ms != null) { +sym = ms.getAtomSymmetry(atom, this.symmetry); +if (sym !== lastSymmetry) { +if (sym.getSpaceGroupOperationCount() == 0) this.finalizeSymmetry(lastSymmetry = sym); +op = sym.getSpaceGroupOperation(0); +}}var c = JU.P3.newP(atom); +op.rotTrans(c); +sym.toCartesian(c, false); +if (this.doPackUnitCell) { +sym.toUnitCellRnd(c, this.ptOffset); +pttemp.setT(c); +sym.toFractional(pttemp, false); +this.acr.fixFloatPt(pttemp, 100000.0); +if (bsAtoms == null) atom.setT(pttemp); + else if (atom.distance(pttemp) < 1.0E-4) bsAtoms.set(atom.index); + else { +bsAtoms.clear(atom.index); +continue; +}}if (bsAtoms != null) atom.bsSymmetry.clearAll(); +atom.bsSymmetry.set(iCell * operationCount); +atom.bsSymmetry.set(0); +if (checkCartesianRange) this.setSymmetryMinMax(c); +if (pt < cartesianCount) cartesians[pt] = c; +} +if (checkRangeNoSymmetry) { +this.rminx -= absRange; +this.rminy -= absRange; +this.rminz -= absRange; +this.rmaxx += absRange; +this.rmaxy += absRange; +this.rmaxz += absRange; +}cell555Count = pt = this.symmetryAddAtoms(0, 0, 0, 0, pt, iCell * operationCount, cartesians, ms, excludedOps, atomMap); +} +} +} +if (checkRange111) { +this.rminx -= absRange; +this.rminy -= absRange; +this.rminz -= absRange; +this.rmaxx += absRange; +this.rmaxy += absRange; +this.rmaxz += absRange; +}iCell = 0; +for (var tx = this.minXYZ.x; tx < this.maxXYZ.x; tx++) { +for (var ty = this.minXYZ.y; ty < this.maxXYZ.y; ty++) { +for (var tz = this.minXYZ.z; tz < this.maxXYZ.z; tz++) { +iCell++; +if (tx != 0 || ty != 0 || tz != 0) pt = this.symmetryAddAtoms(tx, ty, tz, cell555Count, pt, iCell * operationCount, cartesians, ms, excludedOps, atomMap); +} +} +} +if (iCell * n == this.asc.ac - this.firstAtom) this.duplicateAtomProperties(iCell); +this.setCurrentModelInfo(n, sym, unitCells); +this.unitCellParams = null; +this.reset(); +}, "J.adapter.smarter.MSInterface,JU.BS"); +Clazz.defineMethod(c$, "applyRangeSymmetry", +function(bsAtoms){ +var range = this.acr.fillRange; +bsAtoms = this.updateBSAtoms(); +this.acr.forcePacked = true; +this.doPackUnitCell = false; +var minXYZ2 = JU.P3i.new3(this.minXYZ.x, this.minXYZ.y, this.minXYZ.z); +var maxXYZ2 = JU.P3i.new3(this.maxXYZ.x, this.maxXYZ.y, this.maxXYZ.z); +var oabc = new Array(4); +for (var i = 0; i < 4; i++) oabc[i] = JU.P3.newP(range[i]); + +this.setUnitCellSafely(); +this.adjustRangeMinMax(oabc); +var superSymmetry = new J.adapter.smarter.XtalSymmetry.FileSymmetry(); +superSymmetry.getUnitCell(this.acr.fillRange, false, null); +this.applyAllSymmetry(this.acr.ms, bsAtoms); +var pt0 = new JU.P3(); +var atoms = this.asc.atoms; +for (var i = this.asc.ac; --i >= this.firstAtom; ) { +pt0.setT(atoms[i]); +this.symmetry.toCartesian(pt0, false); +superSymmetry.toFractional(pt0, false); +if (this.acr.noPack ? !this.removePacking(this.ndims, pt0, minXYZ2.x, maxXYZ2.x, minXYZ2.y, maxXYZ2.y, minXYZ2.z, maxXYZ2.z, this.packingRange) : !this.isWithinCell(this.ndims, pt0, minXYZ2.x, maxXYZ2.x, minXYZ2.y, maxXYZ2.y, minXYZ2.z, maxXYZ2.z, this.packingRange)) bsAtoms.clear(i); +} +}, "JU.BS"); +Clazz.defineMethod(c$, "applySuperSymmetry", +function(supercell, bsAtoms, iAtomFirst, oabc, pt0, vabc, slop){ +this.asc.setGlobalBoolean(7); +var doPack0 = this.doPackUnitCell; +this.doPackUnitCell = doPack0; +this.applyAllSymmetry(this.acr.ms, null); +this.doPackUnitCell = doPack0; +var atoms = this.asc.atoms; +var atomCount = this.asc.ac; +for (var i = iAtomFirst; i < atomCount; i++) { +this.symmetry.toCartesian(atoms[i], true); +bsAtoms.set(i); +} +this.asc.setCurrentModelInfo("unitcell_conventional", this.symmetry.getV0abc("a,b,c", null)); +var va = vabc[0]; +var vb = vabc[1]; +var vc = vabc[2]; +this.symmetry = new J.adapter.smarter.XtalSymmetry.FileSymmetry(); +this.setUnitCell( Clazz.newFloatArray(-1, [0, 0, 0, 0, 0, 0, va.x, va.y, va.z, vb.x, vb.y, vb.z, vc.x, vc.y, vc.z, 0, 0, 0, 0, 0, 0, NaN, NaN, NaN, NaN, NaN, slop]), null, null); +var name = oabc == null || supercell == null ? "P1" : "cell=" + supercell; +this.setAtomSetSpaceGroupName(name); +this.symmetry.setSpaceGroupName(name); +this.symmetry.setSpaceGroup(this.doNormalize); +this.symmetry.addSpaceGroupOperation("x,y,z", 0); +if (pt0 != null && pt0.length() == 0) pt0 = null; +if (pt0 != null) this.symmetry.toFractional(pt0, true); +for (var i = iAtomFirst; i < atomCount; i++) { +this.symmetry.toFractional(atoms[i], true); +if (pt0 != null) atoms[i].sub(pt0); +} +this.asc.haveAnisou = false; +this.asc.setCurrentModelInfo("matUnitCellOrientation", null); +}, "~S,JU.BS,~N,~A,JU.P3,~A,~N"); +Clazz.defineMethod(c$, "applySymmetryLattice", +function(){ +if (!this.asc.coordinatesAreFractional || this.symmetry.getSpaceGroup() == null) return; +var maxX = this.latticeCells[0]; +var maxY = this.latticeCells[1]; +var maxZ = Math.abs(this.latticeCells[2]); +var kcode = this.latticeCells[3]; +this.firstAtom = this.asc.getLastAtomSetAtomIndex(); +var bsAtoms = this.asc.bsAtoms; +if (bsAtoms != null) { +this.updateBSAtoms(); +this.firstAtom = bsAtoms.nextSetBit(this.firstAtom); +}this.rminx = this.rminy = this.rminz = 3.4028235E38; +this.rmaxx = this.rmaxy = this.rmaxz = -3.4028235E38; +if (this.acr.latticeType == null) this.acr.latticeType = "" + this.symmetry.getLatticeType(); +if (this.acr.isPrimitive) { +this.asc.setCurrentModelInfo("isprimitive", Boolean.TRUE); +if (!"P".equals(this.acr.latticeType) || this.acr.primitiveToCrystal != null) { +this.asc.setCurrentModelInfo("unitcell_conventional", this.symmetry.getConventionalUnitCell(this.acr.latticeType, this.acr.primitiveToCrystal)); +}}this.setUnitCellSafely(); +this.asc.setCurrentModelInfo("f2c", this.symmetry.getUnitCellF2C()); +var s = this.symmetry.getSpaceGroupTitle(); +if (s.indexOf("--") < 0) this.asc.setCurrentModelInfo("f2cTitle", s); +this.asc.setCurrentModelInfo("f2cParams", this.symmetry.getUnitCellParams()); +if (this.acr.latticeType != null) { +this.asc.setCurrentModelInfo("latticeType", this.acr.latticeType); +if ((typeof(this.acr.fillRange)=='string')) { +var range = this.setLatticeRange(this.acr.latticeType, this.acr.fillRange); +if (range == null) { +this.acr.appendLoadNote(this.acr.fillRange + " symmetry could not be implemented"); +this.acr.fillRange = null; +} else { +this.acr.fillRange = range; +}}}this.baseSymmetry = this.symmetry; +if (this.acr.fillRange != null) { +this.setMinMax(this.ndims, kcode, maxX, maxY, maxZ); +this.applyRangeSymmetry(bsAtoms); +return; +}var oabc = null; +var slop = 1e-6; +this.nVib = 0; +var supercell = this.acr.strSupercell; +var isSuper = (supercell != null && supercell.indexOf(",") >= 0); +var matSuper = null; +var pt0 = null; +var vabc = new Array(3); +if (isSuper) { +matSuper = new JU.M4(); +if (this.mident == null) this.mident = new JU.M4(); +this.setUnitCellSafely(); +oabc = this.symmetry.getV0abc(supercell, matSuper); +matSuper.transpose33(); +if (oabc != null && !matSuper.equals(this.mident)) { +this.setMinMax(this.ndims, kcode, maxX, maxY, maxZ); +pt0 = JU.P3.newP(oabc[0]); +vabc[0] = JU.V3.newV(oabc[1]); +vabc[1] = JU.V3.newV(oabc[2]); +vabc[2] = JU.V3.newV(oabc[3]); +this.adjustRangeMinMax(oabc); +}}var iAtomFirst = this.asc.getLastAtomSetAtomIndex(); +if (bsAtoms != null) iAtomFirst = bsAtoms.nextSetBit(iAtomFirst); +if (this.rminx == 3.4028235E38) { +supercell = null; +oabc = null; +} else { +bsAtoms = this.updateBSAtoms(); +slop = this.symmetry.getPrecision(); +this.applySuperSymmetry(supercell, bsAtoms, iAtomFirst, oabc, pt0, vabc, slop); +}this.setMinMax(this.ndims, kcode, maxX, maxY, maxZ); +if (oabc == null) { +this.applyAllSymmetry(this.acr.ms, bsAtoms); +if (!this.acr.noPack && (!this.applySymmetryToBonds || !this.acr.doPackUnitCell)) { +return; +}this.setMinMax(this.ndims, kcode, maxX, maxY, maxZ); +}if (this.acr.forcePacked || this.acr.doPackUnitCell || this.acr.noPack) { +this.trimToUnitCell(iAtomFirst); +}this.updateSupercellAtomSites(matSuper, bsAtoms, slop); +}); +Clazz.defineMethod(c$, "duplicateAtomProperties", +function(nTimes){ +var p = this.asc.getAtomSetAuxiliaryInfoValue(-1, "atomProperties"); +if (p != null) for (var entry, $entry = p.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) { +var key = entry.getKey(); +var val = entry.getValue(); +if ((typeof(val)=='string')) { +var data = val; +var s = new JU.SB(); +for (var i = nTimes; --i >= 0; ) s.append(data); + +p.put(key, s.toString()); +} else { +var f = val; +var fnew = Clazz.newFloatArray (f.length * nTimes, 0); +for (var i = nTimes; --i >= 0; ) System.arraycopy(f, 0, fnew, i * f.length, f.length); + +}} +}, "~N"); +Clazz.defineMethod(c$, "finalizeSymmetry", +function(symmetry){ +var name = this.asc.getAtomSetAuxiliaryInfoValue(-1, "spaceGroup"); +symmetry.setFinalOperations(this.ndims, name, this.asc.atoms, this.firstAtom, this.noSymmetryCount, this.doNormalize, this.filterSymop); +if (this.filterSymop != null || name == null || name.equals("unspecified!")) { +this.setAtomSetSpaceGroupName(symmetry.getSpaceGroupName()); +}if (this.unitCellParams != null || Float.isNaN(this.acr.unitCellParams[0])) return; +if (symmetry.fixUnitCell(this.acr.unitCellParams)) { +this.acr.appendLoadNote("Unit cell parameters were adjusted to match space group!"); +}this.setUnitCellSafely(); +}, "J.adapter.smarter.XtalSymmetry.FileSymmetry"); +Clazz.defineMethod(c$, "removePacking", +function(ndims, pt, minX, maxX, minY, maxY, minZ, maxZ, slop){ +return (pt.x > minX - slop && pt.x < maxX - slop && (ndims < 2 || pt.y > minY - slop && pt.y < maxY - slop) && (ndims < 3 || pt.z > minZ - slop && pt.z < maxZ - slop)); +}, "~N,JU.P3,~N,~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "reset", +function(){ +this.asc.coordinatesAreFractional = false; +this.asc.setCurrentModelInfo("hasSymmetry", Boolean.TRUE); +this.asc.setGlobalBoolean(1); +}); +Clazz.defineMethod(c$, "setAtomSetSpaceGroupName", +function(spaceGroupName){ +this.symmetry.setSpaceGroupName(spaceGroupName); +this.asc.setCurrentModelInfo("spaceGroup", spaceGroupName + ""); +}, "~S"); +Clazz.defineMethod(c$, "setCurrentModelInfo", +function(n, sym, unitCells){ +if (sym == null) { +this.asc.setCurrentModelInfo("presymmetryAtomCount", Integer.$valueOf(this.noSymmetryCount)); +this.asc.setCurrentModelInfo("biosymmetryCount", Integer.$valueOf(n)); +this.asc.setCurrentModelInfo("biosymmetry", this.symmetry); +} else { +this.asc.setCurrentModelInfo("presymmetryAtomCount", Integer.$valueOf(n)); +this.asc.setCurrentModelInfo("latticeDesignation", sym.getLatticeDesignation()); +this.asc.setCurrentModelInfo("ML_unitCellRange", unitCells); +if (this.acr.isSUPERCELL) this.asc.setCurrentModelInfo("supercell", this.acr.strSupercell); +}this.asc.setCurrentModelInfo("presymmetryAtomIndex", Integer.$valueOf(this.firstAtom)); +var operationCount = this.symmetry.getSpaceGroupOperationCount(); +if (operationCount > 0) { +var symmetryList = new Array(operationCount); +for (var i = 0; i < operationCount; i++) symmetryList[i] = "" + this.symmetry.getSpaceGroupXyz(i, this.doNormalize); + +this.asc.setCurrentModelInfo("symmetryOperations", symmetryList); +this.asc.setCurrentModelInfo("symmetryOps", this.symmetry.getSymmetryOperations()); +}this.asc.setCurrentModelInfo("symmetryCount", Integer.$valueOf(operationCount)); +this.asc.setCurrentModelInfo("latticeType", this.acr.latticeType == null ? "P" : this.acr.latticeType); +this.asc.setCurrentModelInfo("intlTableNo", this.symmetry.getIntTableNumber()); +this.asc.setCurrentModelInfo("intlTableIndex", this.symmetry.getSpaceGroupInfoObj("itaIndex", null, false, false)); +this.asc.setCurrentModelInfo("intlTableTransform", this.symmetry.getSpaceGroupInfoObj("itaTransform", null, false, false)); +this.asc.setCurrentModelInfo("intlTableJmolID", this.symmetry.getIntTableNumberFull()); +this.asc.setCurrentModelInfo("spaceGroupIndex", Integer.$valueOf(this.symmetry.getSpaceGroupIndex())); +this.asc.setCurrentModelInfo("spaceGroupTitle", this.symmetry.getSpaceGroupTitle()); +if (this.acr.sgName == null || this.acr.sgName.indexOf("?") >= 0 || this.acr.sgName.indexOf("!") >= 0) this.setAtomSetSpaceGroupName(this.acr.sgName = this.symmetry.getSpaceGroupName()); +}, "~N,J.adapter.smarter.XtalSymmetry.FileSymmetry,~A"); +Clazz.defineMethod(c$, "setCurrentModelUCInfo", +function(unitCellParams, unitCellOffset, matUnitCellOrientation){ +if (unitCellParams != null) this.asc.setCurrentModelInfo("unitCellParams", unitCellParams); +if (unitCellOffset != null) this.asc.setCurrentModelInfo("unitCellOffset", unitCellOffset); +if (matUnitCellOrientation != null) this.asc.setCurrentModelInfo("matUnitCellOrientation", matUnitCellOrientation); +}, "~A,JU.P3,JU.M3"); +Clazz.defineMethod(c$, "setLatticeCells", +function(){ +this.latticeCells = this.acr.latticeCells; +var isLatticeRange = (this.latticeCells[0] <= 555 && this.latticeCells[1] >= 555 && (this.latticeCells[2] == 0 || this.latticeCells[2] == 1 || this.latticeCells[2] == -1)); +this.doNormalize = this.latticeCells[0] != 0 && (!isLatticeRange || this.latticeCells[2] == 1); +this.applySymmetryToBonds = this.acr.applySymmetryToBonds; +this.doPackUnitCell = this.acr.doPackUnitCell && !this.applySymmetryToBonds; +this.doCentroidUnitCell = this.acr.doCentroidUnitCell; +this.centroidPacked = this.acr.centroidPacked; +this.filterSymop = this.acr.filterSymop; +}); +Clazz.defineMethod(c$, "setLatticeRange", +function(latticetype, rangeType){ +var range = null; +var isRhombohedral = "R".equals(latticetype); +if (rangeType.equals("conventional")) { +range = this.symmetry.getConventionalUnitCell(latticetype, this.acr.primitiveToCrystal); +} else if (rangeType.equals("primitive")) { +range = this.symmetry.getUnitCellVectors(); +this.symmetry.toFromPrimitive(true, latticetype.charAt(0), range, this.acr.primitiveToCrystal); +} else if (isRhombohedral && rangeType.equals("rhombohedral")) { +if (this.symmetry.getUnitCellInfoType(7) == 1) { +rangeType = "2/3a+1/3b+1/3c,-1/3a+1/3b+1/3c,-1/3a-2/3b+1/3c"; +} else { +rangeType = null; +}} else if (isRhombohedral && rangeType.equals("trigonal")) { +if (this.symmetry.getUnitCellInfoType(8) == 1) { +rangeType = "a-b,b-c,a+b+c"; +} else { +rangeType = null; +}} else if (rangeType.indexOf(",") < 0 || rangeType.indexOf("a") < 0 || rangeType.indexOf("b") < 0 || rangeType.indexOf("c") < 0) { +rangeType = null; +} else { +rangeType = null; +}if (rangeType != null && range == null && (range = this.symmetry.getV0abc(rangeType, null)) == null) { +rangeType = null; +}if (rangeType == null) return null; +this.acr.addJmolScript("unitcell " + JU.PT.esc(rangeType)); +return range; +}, "~S,~S"); +Clazz.defineMethod(c$, "setMinMax", +function(dim, kcode, maxX, maxY, maxZ){ +this.minXYZ = new JU.P3i(); +this.maxXYZ = JU.P3i.new3(maxX, maxY, maxZ); +JU.SimpleUnitCell.setMinMaxLatticeParameters(dim, this.minXYZ, this.maxXYZ, kcode); +}, "~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "setSymmetryMinMax", +function(c){ +if (this.rminx > c.x) this.rminx = c.x; +if (this.rminy > c.y) this.rminy = c.y; +if (this.rminz > c.z) this.rminz = c.z; +if (this.rmaxx < c.x) this.rmaxx = c.x; +if (this.rmaxy < c.y) this.rmaxy = c.y; +if (this.rmaxz < c.z) this.rmaxz = c.z; +}, "JU.P3"); +Clazz.defineMethod(c$, "setUnitCell", +function(info, matUnitCellOrientation, unitCellOffset){ +this.unitCellParams = Clazz.newFloatArray (info.length, 0); +for (var i = 0; i < info.length; i++) this.unitCellParams[i] = info[i]; + +this.asc.haveUnitCell = true; +if (this.asc.isTrajectory) { +if (this.trajectoryUnitCells == null) { +this.trajectoryUnitCells = new JU.Lst(); +this.asc.setInfo("unitCells", this.trajectoryUnitCells); +}this.trajectoryUnitCells.addLast(this.unitCellParams); +}this.asc.setGlobalBoolean(2); +this.getSymmetry().setUnitCellFromParams(this.unitCellParams, false, this.unitCellParams[26]); +if (unitCellOffset != null) this.symmetry.setOffsetPt(unitCellOffset); +if (matUnitCellOrientation != null) this.symmetry.initializeOrientation(matUnitCellOrientation); +this.setCurrentModelUCInfo(this.unitCellParams, unitCellOffset, matUnitCellOrientation); +}, "~A,JU.M3,JU.P3"); +Clazz.defineMethod(c$, "setUnitCellSafely", +function(){ +if (this.unitCellParams == null) this.setUnitCell(this.acr.unitCellParams, this.acr.matUnitCellOrientation, this.acr.unitCellOffset); +}); +Clazz.defineMethod(c$, "symmetryAddAtoms", +function(transX, transY, transZ, baseCount, pt, iCellOpPt, cartesians, ms, excludedOps, atomMap){ +var isBaseCell = (baseCount == 0); +var addBonds = (atomMap != null); +if (this.doPackUnitCell) this.ptOffset.set(transX, transY, transZ); +var range2 = this.symmetryRange * this.symmetryRange; +var checkRangeNoSymmetry = (this.symmetryRange < 0); +var checkRange111 = (this.symmetryRange > 0); +var checkSymmetryMinMax = (isBaseCell && checkRange111); +checkRange111 = new Boolean (checkRange111 & !isBaseCell).valueOf(); +var nOp = this.symmetry.getSpaceGroupOperationCount(); +var lstNCS = this.acr.lstNCS; +var nNCS = (lstNCS == null ? 0 : lstNCS.size()); +var nOperations = nOp + nNCS; +nNCS = Clazz.doubleToInt(nNCS / nOp); +var checkNearAtoms = (this.checkNearAtoms && (nOperations > 1 || this.doPackUnitCell)); +var checkSymmetryRange = (checkRangeNoSymmetry || checkRange111); +var checkDistances = (checkNearAtoms || checkSymmetryRange); +var checkOps = (excludedOps != null); +var addCartesian = (checkNearAtoms || checkSymmetryMinMax); +var bsAtoms = (this.acr.isMolecular ? null : this.asc.bsAtoms); +var sym = this.symmetry; +if (checkRangeNoSymmetry) baseCount = this.noSymmetryCount; +var atomMax = this.firstAtom + this.noSymmetryCount; +var bondAtomMin = (this.asc.firstAtomToBond < 0 ? atomMax : this.asc.firstAtomToBond); +var pttemp = new JU.P3(); +var code = null; +var minCartDist2 = (checkOps ? 0.01 : 1.0E-4); +var subSystemId = '\u0000'; +var j00 = (bsAtoms == null ? this.firstAtom : bsAtoms.nextSetBit(this.firstAtom)); +out : for (var iSym = 0; iSym < nOperations; iSym++) { +if (isBaseCell && iSym == 0 || this.crystalReaderLatticeOpsOnly && iSym > 0 && (iSym % this.latticeOp) != 0 || excludedOps != null && excludedOps.get(iSym)) continue; +var pt0 = this.firstAtom + (checkNearAtoms ? pt : checkRange111 ? baseCount : 0); +var spinOp = (iSym >= nOp ? 0 : this.asc.vibScale == 0 ? sym.getSpinOp(iSym) : this.asc.vibScale); +var i0 = Math.max(this.firstAtom, (bsAtoms == null ? 0 : bsAtoms.nextSetBit(0))); +var checkDistance = checkDistances; +var spt = (iSym >= nOp ? Clazz.doubleToInt((iSym - nOp) / nNCS) : iSym); +var cpt = spt + iCellOpPt; +for (var i = i0; i < atomMax; i++) { +var a = this.asc.atoms[i]; +if (bsAtoms != null && !bsAtoms.get(i)) continue; +if (ms == null) { +sym.newSpaceGroupPoint(a, iSym, (iSym >= nOp ? lstNCS.get(iSym - nOp) : null), transX, transY, transZ, pttemp); +} else { +sym = ms.getAtomSymmetry(a, this.symmetry); +sym.newSpaceGroupPoint(a, iSym, null, transX, transY, transZ, pttemp); +code = sym.getSpaceGroupOperationCode(iSym); +if (code != null) { +subSystemId = code.charAt(0); +sym = ms.getSymmetryFromCode(code); +if (sym.getSpaceGroupOperationCount() == 0) this.finalizeSymmetry(sym); +}}this.acr.fixFloatPt(pttemp, 100000.0); +var c = JU.P3.newP(pttemp); +sym.toCartesian(c, false); +if (this.doPackUnitCell) { +sym.toUnitCellRnd(c, this.ptOffset); +pttemp.setT(c); +sym.toFractional(pttemp, false); +this.acr.fixFloatPt(pttemp, 100000.0); +if (!this.isWithinCell(this.ndims, pttemp, this.minXYZ0.x, this.maxXYZ0.x, this.minXYZ0.y, this.maxXYZ0.y, this.minXYZ0.z, this.maxXYZ0.z, this.packingRange)) { +continue; +}}if (checkSymmetryMinMax) this.setSymmetryMinMax(c); +var special = null; +if (checkDistance) { +if (checkSymmetryRange && (c.x < this.rminx || c.y < this.rminy || c.z < this.rminz || c.x > this.rmaxx || c.y > this.rmaxy || c.z > this.rmaxz)) continue; +var minDist2 = 3.4028235E38; +var j0 = (this.checkAll ? this.asc.ac : pt0); +var name = a.atomName; +var id = (code == null ? a.altLoc : subSystemId); +for (var j = j00; j < j0; j++) { +if (bsAtoms != null && !bsAtoms.get(j)) continue; +var pc = cartesians[j - this.firstAtom]; +if (pc == null) continue; +var d2 = c.distanceSquared(pc); +if (checkNearAtoms && d2 < minCartDist2) { +if (checkOps) { +excludedOps.set(iSym); +continue out; +}special = this.asc.atoms[j]; +if ((special.atomName == null || special.atomName.equals(name)) && special.altLoc == id) break; +special = null; +}if (checkRange111 && j < baseCount && d2 < minDist2) minDist2 = d2; +} +if (checkRange111 && minDist2 > range2) continue; +}if (checkOps) { +checkDistance = false; +}var atomSite = a.atomSite; +if (special != null) { +if (addBonds) atomMap[atomSite] = special.index; +special.bsSymmetry.set(cpt); +special.bsSymmetry.set(spt); +} else { +if (addBonds) atomMap[atomSite] = this.asc.ac; +var atom1 = a.copyTo(pttemp, this.asc); +if (this.asc.bsAtoms != null) this.asc.bsAtoms.set(atom1.index); +if (spinOp != 0 && atom1.vib != null) { +sym.getSpaceGroupOperation(iSym).rotate(atom1.vib); +atom1.vib.scale(spinOp); +}if (atom1.isNegDisorder) { +if (this.disorderMap == null) this.disorderMap = new java.util.Hashtable(); +var key = Integer.$valueOf(iSym * 1000 + atom1.altLoc.charCodeAt(0)); +var ch = this.disorderMap.get(key); +if (ch == null) { +if (this.disorderMapMax == 0 || this.disorderMapMax == 90) this.disorderMapMax = ('@').charCodeAt(0); +this.disorderMap.put(key, ch = new Character(String.fromCharCode(++this.disorderMapMax))); +}atom1.altLoc = ch.charValue(); +}atom1.atomSite = atomSite; +if (code != null) atom1.altLoc = subSystemId; +atom1.bsSymmetry = JU.BSUtil.newAndSetBit(cpt); +atom1.bsSymmetry.set(spt); +if (addCartesian) cartesians[pt++] = c; +var tensors = a.tensors; +if (tensors != null) { +atom1.tensors = null; +for (var j = tensors.size(); --j >= 0; ) { +var t = tensors.get(j); +if (t == null) continue; +if (nOp == 1) atom1.addTensor(t.copyTensor(), null, false); + else this.addRotatedTensor(atom1, t, iSym, false, sym); +} +}}} +if (addBonds) { +var bonds = this.asc.bonds; +var atoms = this.asc.atoms; +var key; +for (var bondNum = this.asc.bondIndex0; bondNum < this.bondCount0; bondNum++) { +var bond = bonds[bondNum]; +var atom1 = atoms[bond.atomIndex1]; +var atom2 = atoms[bond.atomIndex2]; +if (atom1 == null || atom2 == null || atom2.atomSetIndex < atom1.atomSetIndex) continue; +var ia1 = atomMap[atom1.atomSite]; +var ia2 = atomMap[atom2.atomSite]; +if (ia1 > ia2) { +var i = ia1; +ia1 = ia2; +ia2 = i; +}if (ia1 != ia2 && (ia1 >= bondAtomMin || ia2 >= bondAtomMin) && this.bondsFound.indexOf(key = "-" + ia1 + "," + ia2) < 0) { +this.bondsFound.append(key); +this.asc.addNewBondWithOrder(ia1, ia2, bond.order); +}} +}} +return pt; +}, "~N,~N,~N,~N,~N,~N,~A,J.adapter.smarter.MSInterface,JU.BS,~A"); +Clazz.defineMethod(c$, "trimToUnitCell", +function(iAtomFirst){ +var atoms = this.asc.atoms; +var bs = this.updateBSAtoms(); +if (this.acr.noPack) { +for (var i = bs.nextSetBit(iAtomFirst); i >= 0; i = bs.nextSetBit(i + 1)) { +if (!this.removePacking(this.ndims, atoms[i], this.minXYZ.x, this.maxXYZ.x, this.minXYZ.y, this.maxXYZ.y, this.minXYZ.z, this.maxXYZ.z, this.packingRange)) bs.clear(i); +} +} else { +for (var i = bs.nextSetBit(iAtomFirst); i >= 0; i = bs.nextSetBit(i + 1)) { +if (!this.isWithinCell(this.ndims, atoms[i], this.minXYZ.x, this.maxXYZ.x, this.minXYZ.y, this.maxXYZ.y, this.minXYZ.z, this.maxXYZ.z, this.packingRange)) bs.clear(i); +} +}}, "~N"); +Clazz.defineMethod(c$, "updateBSAtoms", +function(){ +var bs = this.asc.bsAtoms; +if (bs == null) bs = this.asc.bsAtoms = JU.BSUtil.newBitSet2(0, this.asc.ac); +if (bs.nextSetBit(this.firstAtom) < 0) bs.setBits(this.firstAtom, this.asc.ac); +return bs; +}); +Clazz.defineMethod(c$, "updateSupercellAtomSites", +function(matSuper, bsAtoms, slop){ +var n = bsAtoms.cardinality(); +var baseAtoms = new Array(n); +var nbase = 0; +var slop2 = slop * slop; +for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) { +var a = this.asc.atoms[i]; +var p = new J.adapter.smarter.Atom(); +p.setT(a); +if (matSuper != null) { +matSuper.rotTrans(p); +JU.SimpleUnitCell.unitizeDimRnd(3, p, slop); +}p.atomSerial = a.atomSite; +p.atomSite = a.atomSite; +this.symmetry.unitize(p); +var found = false; +for (var ib = 0; ib < nbase; ib++) { +var b = baseAtoms[ib]; +if (p.atomSerial == b.atomSerial && p.distanceSquared(b) < slop2) { +found = true; +a.atomSite = b.atomSite; +break; +}} +if (!found) { +a.atomSite = p.atomSite = nbase; +baseAtoms[nbase++] = p; +}} +}, "JU.M4,JU.BS,~N"); +Clazz.defineMethod(c$, "newFileSymmetry", +function(){ +return new J.adapter.smarter.XtalSymmetry.FileSymmetry(); +}); +/*if3*/;(function(){ +var c$ = Clazz.declareType(J.adapter.smarter.XtalSymmetry, "FileSymmetry", JS.Symmetry); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.adapter.smarter.XtalSymmetry.FileSymmetry, []); +}); +Clazz.defineMethod(c$, "addLatticeVectors", +function(lattvecs){ +return this.spaceGroup.addLatticeVectors(lattvecs); +}, "JU.Lst"); +Clazz.defineMethod(c$, "addSubSystemOp", +function(code, rs, vs, sigma){ +this.spaceGroup.isSSG = true; +var s = JS.SymmetryOperation.getXYZFromRsVs(rs, vs, false); +var i = this.spaceGroup.addSymmetry(s, -1, true); +this.spaceGroup.operations[i].setSigma(code, sigma); +return s; +}, "~S,JU.Matrix,JU.Matrix,JU.Matrix"); +Clazz.defineMethod(c$, "checkDistance", +function(f1, f2, distance, dx, iRange, jRange, kRange, ptOffset){ +return this.unitCell.checkDistance(f1, f2, distance, dx, iRange, jRange, kRange, ptOffset); +}, "JU.P3,JU.P3,~N,~N,~N,~N,~N,JU.P3"); +Clazz.defineMethod(c$, "createSpaceGroup", +function(desiredSpaceGroupIndex, name, data, modDim){ +this.spaceGroup = JS.SpaceGroup.createSpaceGroup(desiredSpaceGroupIndex, name, data, modDim); +if (this.spaceGroup != null && JU.Logger.debugging) JU.Logger.debug("using generated space group " + this.spaceGroup.dumpInfo()); +return this.spaceGroup != null; +}, "~N,~S,~O,~N"); +Clazz.defineMethod(c$, "fcoord", +function(p){ +return JS.SymmetryOperation.fcoord(p, " "); +}, "JU.T3"); +Clazz.defineMethod(c$, "getMatrixFromString", +function(xyz, rotTransMatrix){ +JS.SymmetryOperation.getMatrixFromString(null, xyz, rotTransMatrix, false, true, false); +}, "~S,~A"); +Clazz.defineMethod(c$, "getSpaceGroupOperationCode", +function(iOp){ +return this.spaceGroup.operations[iOp].subsystemCode; +}, "~N"); +Clazz.defineMethod(c$, "getTensor", +function(vwr, parBorU){ +if (parBorU == null) return null; +if (this.unitCell == null) this.unitCell = JS.UnitCell.fromParams( Clazz.newFloatArray(-1, [1, 1, 1, 90, 90, 90]), true, 1.0E-4); +return this.unitCell.getTensor(vwr, parBorU); +}, "JV.Viewer,~A"); +Clazz.defineMethod(c$, "getSpaceGroupTitle", +function(){ +var s = this.getSpaceGroupName(); +return (s.startsWith("cell=") ? s : this.spaceGroup != null ? this.spaceGroup.asString() : this.unitCell != null && this.unitCell.name.length > 0 ? "cell=" + this.unitCell.name : ""); +}); +Clazz.defineMethod(c$, "setPrecision", +function(prec){ +this.unitCell.setPrecision(prec); +}, "~N"); +Clazz.defineMethod(c$, "toFractionalM", +function(m){ +if (!this.$isBio) this.unitCell.toFractionalM(m); +}, "JU.M4"); +Clazz.defineMethod(c$, "toUnitCellRnd", +function(pt, offset){ +this.unitCell.toUnitCellRnd(pt, offset); +}, "JU.T3,JU.T3"); +Clazz.defineMethod(c$, "twelfthify", +function(pt){ +this.unitCell.twelfthify(pt); +}, "JU.P3"); +Clazz.defineMethod(c$, "getConventionalUnitCell", +function(latticeType, primitiveToCrystal){ +return (this.unitCell == null || latticeType == null ? null : this.unitCell.getConventionalUnitCell(latticeType, primitiveToCrystal)); +}, "~S,JU.M3"); +Clazz.defineMethod(c$, "getSpaceGroupIndex", +function(){ +return this.spaceGroup.getIndex(); +}); +Clazz.defineMethod(c$, "getUnitCellF2C", +function(){ +return this.unitCell.getF2C(); +}); +Clazz.defineMethod(c$, "addInversion", +function(){ +var ops = this.spaceGroup.operations; +var inv = new JU.M4(); +inv.m00 = inv.m11 = inv.m22 = -1; +inv.m33 = 1; +var n = this.getSpaceGroupOperationCount(); +var m = new JU.M4(); +for (var i = 0; i < n; i++) { +m.mul2(inv, ops[i]); +var s = JS.SymmetryOperation.getXYZFromMatrix(m, true, true, false); +this.addSpaceGroupOperation(s, 0); +} +}); +/*eoif3*/})(); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/CDXMLWriter.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/CDXMLWriter.js new file mode 100755 index 000000000000..b5ae7197019d --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/CDXMLWriter.js @@ -0,0 +1,504 @@ +Clazz.declarePackage("J.adapter.writers"); +Clazz.load(["J.adapter.writers.CMLWriter", "java.util.Stack", "JU.SB"], "J.adapter.writers.CDXMLWriter", ["java.util.Hashtable", "JU.PT", "$.Rdr", "J.adapter.smarter.SmarterJmolAdapter"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.doc = null; +this.objects = null; +this.sb = null; +this.sbpt = 0; +this.id = 0; +Clazz.instantialize(this, arguments);}, J.adapter.writers, "CDXMLWriter", J.adapter.writers.CMLWriter); +Clazz.prepareFields (c$, function(){ +this.objects = new java.util.Stack(); +this.sb = new JU.SB(); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.adapter.writers.CDXMLWriter, []); +}); +Clazz.overrideMethod(c$, "set", +function(viewer, out, data){ +throw new NullPointerException("CDXMLWriter is not implemented for writing"); +}, "JV.Viewer,JU.OC,~A"); +Clazz.overrideMethod(c$, "write", +function(bs){ +throw new NullPointerException("CDXMLWriter is not implemented for writing"); +}, "JU.BS"); +c$.fromCDX = Clazz.defineMethod(c$, "fromCDX", +function(binaryDoc){ +return new J.adapter.writers.CDXMLWriter().cdxToCdxml(binaryDoc); +}, "javajs.api.GenericBinaryDocument"); +c$.fromASC = Clazz.defineMethod(c$, "fromASC", +function(asc){ +return new J.adapter.writers.CDXMLWriter().ascToCdxml(asc); +}, "J.adapter.smarter.AtomSetCollection"); +Clazz.defineMethod(c$, "ascToCdxml", +function(asc){ +var a = new J.adapter.smarter.SmarterJmolAdapter(); +var atomIterator = a.getAtomIterator(asc); +var bondIterator = a.getBondIterator(asc); +J.adapter.writers.CMLWriter.openDocument(this.sb); +J.adapter.writers.CDXMLWriter.appendHeader(this.sb); +J.adapter.writers.CMLWriter.openTag(this.sb, "page"); +this.id = 0; +this.openID(this.sb, "fragment"); +J.adapter.writers.CMLWriter.terminateTag(this.sb); +var indexToID = new java.util.Hashtable(); +while (atomIterator.hasNext()) { +this.openID(this.sb, "n"); +indexToID.put(atomIterator.getUniqueID(), Integer.$valueOf(this.id)); +var xyz = atomIterator.getXYZ(); +var ele = atomIterator.getElement(); +var iso = atomIterator.getIsotope(); +var charge = atomIterator.getFormalCharge(); +J.adapter.writers.CMLWriter.addAttribute(this.sb, "p", J.adapter.writers.CDXMLWriter.cdxCoord(xyz.x, 200) + " " + J.adapter.writers.CDXMLWriter.cdxCoord(-xyz.y, 400)); +if (ele != 6) J.adapter.writers.CMLWriter.addAttribute(this.sb, "Element", "" + ele); +if (iso != 0) J.adapter.writers.CMLWriter.addAttribute(this.sb, "Isotope", "" + iso); +if (charge != 0) J.adapter.writers.CMLWriter.addAttribute(this.sb, "Charge", "" + charge); +J.adapter.writers.CMLWriter.terminateEmptyTag(this.sb); +} +while (bondIterator.hasNext()) { +this.openID(this.sb, "b"); +var id1 = bondIterator.getAtomUniqueID1(); +var id2 = bondIterator.getAtomUniqueID2(); +var order = "1"; +var display = null; +var display2 = null; +var bo = bondIterator.getEncodedOrder(); +switch (bo) { +case 515: +order = "1.5"; +display2 = "Dash"; +break; +case 514: +order = "2"; +break; +default: +if ((bo & 0x07) != 0) order = "" + (bo & 0x07); +break; +} +switch (bo) { +case 1025: +order = "1"; +display = "WedgeBegin"; +break; +case 1041: +order = "1"; +display = "WedgedHashBegin"; +break; +case 1057: +order = "1"; +display = "Wavy"; +break; +} +J.adapter.writers.CMLWriter.addAttribute(this.sb, "B", indexToID.get(id1).toString()); +J.adapter.writers.CMLWriter.addAttribute(this.sb, "E", indexToID.get(id2).toString()); +if (!order.equals("1")) J.adapter.writers.CMLWriter.addAttribute(this.sb, "Order", order); +if (display != null) J.adapter.writers.CMLWriter.addAttribute(this.sb, "Display", display); +if (display2 != null) J.adapter.writers.CMLWriter.addAttribute(this.sb, "Display2", display2); +J.adapter.writers.CMLWriter.terminateEmptyTag(this.sb); +} +J.adapter.writers.CMLWriter.closeTag(this.sb, "fragment"); +J.adapter.writers.CMLWriter.closeTag(this.sb, "page"); +J.adapter.writers.CMLWriter.closeTag(this.sb, "CDXML"); +return this.sb.toString(); +}, "J.adapter.smarter.AtomSetCollection"); +c$.cdxCoord = Clazz.defineMethod(c$, "cdxCoord", +function(x, off){ +return "" + (off + Math.round(x / 1.45 * 14.4 * 100) / 100); +}, "~N,~N"); +Clazz.defineMethod(c$, "openID", +function(sb, name){ +J.adapter.writers.CMLWriter.startOpenTag(sb, name); +J.adapter.writers.CMLWriter.addAttribute(sb, "id", "" + ++this.id); +}, "JU.SB,~S"); +Clazz.defineMethod(c$, "cdxToCdxml", +function(doc){ +this.doc = doc; +try { +J.adapter.writers.CMLWriter.openDocument(this.sb); +J.adapter.writers.CDXMLWriter.appendHeader(this.sb); +doc.setStreamData(null, false); +doc.seek(22); +this.processObject(doc.readShort()); +this.sb.append("\n"); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +System.out.println(this.sb + "\n" + this.objects); +e.printStackTrace(); +return null; +} else { +throw e; +} +} +return this.sb.toString(); +}, "javajs.api.GenericBinaryDocument"); +c$.appendHeader = Clazz.defineMethod(c$, "appendHeader", +function(sb){ +sb.append("\n"); +J.adapter.writers.CMLWriter.startOpenTag(sb, "CDXML"); +J.adapter.writers.CMLWriter.addAttributes(sb, J.adapter.writers.CDXMLWriter.cdxAttributes); +J.adapter.writers.CMLWriter.terminateTag(sb); +}, "JU.SB"); +Clazz.defineMethod(c$, "processObject", +function(type){ +var id = this.doc.readInt(); +type = type & 0xFFFF; +var terminated = false; +var name = null; +switch (type) { +case 32768: +case 32770: +default: +id = -2147483648; +terminated = true; +break; +case 32769: +name = "page"; +id = -2147483648; +break; +case 32771: +name = "fragment"; +break; +case 32772: +name = "n"; +break; +case 32773: +name = "b"; +break; +case 32774: +name = "t"; +id = -2147483648; +break; +} +this.sbpt = this.sb.length(); +this.objects.push(name); +if (name != null) { +J.adapter.writers.CMLWriter.startOpenTag(this.sb, name); +if (id != -2147483648) { +J.adapter.writers.CMLWriter.addAttribute(this.sb, "id", "" + id); +}}var prop; +while ((prop = this.doc.readShort()) != 0) { +if ((prop & 0x8000) != 0) { +if (!terminated) { +J.adapter.writers.CMLWriter.terminateTag(this.sb); +terminated = true; +}this.processObject(prop); +continue; +}var len = this.readLength(); +switch (type) { +case 32772: +this.writeNodeProperties(prop, len); +break; +case 32774: +if (!terminated) { +J.adapter.writers.CMLWriter.terminateTag(this.sb); +terminated = true; +}this.writeTextProperty(prop, len); +break; +case 32773: +this.writeBondProperties(prop, len); +break; +default: +this.skip(len); +break; +} +} +if (name != null) { +if (!terminated) { +J.adapter.writers.CMLWriter.terminateEmptyTag(this.sb); +} else { +J.adapter.writers.CMLWriter.closeTag(this.sb, name); +}}}, "~N"); +Clazz.defineMethod(c$, "writeNodeProperties", +function(prop, len){ +switch (prop) { +case 512: +var y = J.adapter.writers.CDXMLWriter.toPoint(this.readInt(len >> 1)); +var x = J.adapter.writers.CDXMLWriter.toPoint(this.readInt(len >> 1)); +J.adapter.writers.CMLWriter.addAttribute(this.sb, "p", x + " " + y); +break; +case 1024: +var nodeType = J.adapter.writers.CDXMLWriter.getNodeType(this.readInt(len)); +J.adapter.writers.CMLWriter.addAttribute(this.sb, "NodeType", nodeType); +break; +case 1026: +J.adapter.writers.CMLWriter.addAttribute(this.sb, "Element", "" + this.readInt(len)); +break; +case 1056: +J.adapter.writers.CMLWriter.addAttribute(this.sb, "Isotope", "" + this.readInt(len)); +break; +case 1057: +J.adapter.writers.CMLWriter.addAttribute(this.sb, "Charge", "" + this.readInt(len)); +break; +case 16: +J.adapter.writers.CMLWriter.addAttribute(this.sb, "Warning", this.readString(len)); +break; +case 1073: +J.adapter.writers.CMLWriter.addAttribute(this.sb, "BondOrdering", this.readArray()); +break; +case 1285: +J.adapter.writers.CMLWriter.addAttribute(this.sb, "ConnectionOrder", this.readArray()); +break; +case 1074: +J.adapter.writers.CMLWriter.addAttribute(this.sb, "Attachments", this.readArray()); +break; +case 1075: +J.adapter.writers.CMLWriter.addAttribute(this.sb, "GenericNickname", this.readString(len)); +break; +default: +this.skip(len); +} +}, "~N,~N"); +Clazz.defineMethod(c$, "writeBondProperties", +function(prop, len){ +switch (prop) { +case 1536: +var order = J.adapter.writers.CDXMLWriter.getBondOrder(this.readInt(len)); +if (order == null) { +this.removeObject(); +return; +}J.adapter.writers.CMLWriter.addAttribute(this.sb, "Order", order); +break; +case 1537: +var d = J.adapter.writers.CDXMLWriter.getBondDisplay(this.readInt(len)); +if (d == null) { +this.removeObject(); +return; +}J.adapter.writers.CMLWriter.addAttribute(this.sb, "Display", d); +break; +case 1538: +var d2 = J.adapter.writers.CDXMLWriter.getBondDisplay(this.readInt(len)); +if (d2 != null) J.adapter.writers.CMLWriter.addAttribute(this.sb, "Display2", d2); +break; +case 1540: +J.adapter.writers.CMLWriter.addAttribute(this.sb, "B", "" + this.readInt(len)); +break; +case 1541: +J.adapter.writers.CMLWriter.addAttribute(this.sb, "E", "" + this.readInt(len)); +break; +case 1544: +J.adapter.writers.CMLWriter.addAttribute(this.sb, "BeginAttach", "" + this.readInt(len)); +break; +case 1545: +J.adapter.writers.CMLWriter.addAttribute(this.sb, "EndAttach", "" + this.readInt(len)); +break; +default: +this.skip(len); +} +}, "~N,~N"); +Clazz.defineMethod(c$, "writeTextProperty", +function(prop, len){ +switch (prop) { +case 1792: +var text = this.readString(len); +System.out.println("CDXMLW text=" + text); +J.adapter.writers.CMLWriter.openTag(this.sb, "s"); +this.sb.setLength(this.sb.length() - 1); +this.sb.append(J.adapter.writers.CDXMLWriter.wrapCData(text)); +J.adapter.writers.CMLWriter.closeTag(this.sb, "s"); +break; +default: +this.skip(len); +} +}, "~N,~N"); +c$.wrapCData = Clazz.defineMethod(c$, "wrapCData", +function(s){ +return (s.indexOf("&") < 0 && s.indexOf("<") < 0 ? s : "", "]]]]>") + "]]>"); +}, "~S"); +c$.getNodeType = Clazz.defineMethod(c$, "getNodeType", +function(n){ +var name = null; +switch (n) { +case 0: +return "Unspecified"; +case 1: +return "Element"; +case 4: +return "Nickname"; +case 5: +return "Fragment"; +case 7: +return "GenericNickname"; +case 10: +return "MultiAttachment"; +case 11: +return "VariableAttachment"; +case 12: +return "ExternalConnectionPoint"; +case 2: +name = "ElementList"; +break; +case 3: +name = "ElementListNickname"; +break; +case 6: +name = "Formula"; +break; +case 8: +name = "AnonymousAlternativeGroup"; +break; +case 9: +name = "NamedAnonymousGroup"; +break; +case 13: +name = "LinkNode"; +break; +} +System.err.println("CDXMLWriter Node type " + name + " not identified"); +return "_"; +}, "~N"); +c$.getBondDisplay = Clazz.defineMethod(c$, "getBondDisplay", +function(i){ +switch (i) { +case 0: +return "Solid"; +case 1: +return "Dash"; +case 2: +return "Hash"; +case 3: +return "WedgedHashBegin"; +case 4: +return "WedgedHashEnd"; +case 5: +return "Bold"; +case 6: +return "WedgeBegin"; +case 7: +return "WedgeEnd"; +case 8: +return "Wavy"; +case 9: +return "HollowWedgeBegin"; +case 10: +return "HollowWedgeEnd"; +case 11: +return "WavyWedgeBegin"; +case 12: +return "WavyWedgeEnd"; +case 13: +return "Dot"; +case 14: +return "DashDot"; +} +return null; +}, "~N"); +c$.getBondOrder = Clazz.defineMethod(c$, "getBondOrder", +function(i){ +switch (i) { +case 1: +return "1"; +case 2: +return "2"; +case 4: +return "3"; +case 8: +return "4"; +case 16: +return "5"; +case 32: +return "6"; +case 64: +return "0.5"; +case 128: +return "1.5"; +case 256: +return "2.5"; +case 512: +return "3.5"; +case 1024: +return "4.5"; +case 2048: +return "5.5"; +case 4096: +return "dative"; +case 8192: +return "ionic"; +case 16384: +return "hydrogen"; +case 32768: +return "threecenter"; +} +return null; +}, "~N"); +Clazz.defineMethod(c$, "removeObject", +function(){ +this.sb.setLength(this.sbpt); +}); +Clazz.defineMethod(c$, "skip", +function(len){ +this.doc.seek(this.doc.getPosition() + len); +}, "~N"); +Clazz.defineMethod(c$, "readInt", +function(len){ +switch (len) { +case 1: +return (256 + this.doc.readByte()) % 256; +case 2: +return this.doc.readShort(); +case 4: +return this.doc.readInt(); +case 8: +return this.doc.readLong(); +} +System.err.println("CDXMLWriter.readInt len " + len); +return 0; +}, "~N"); +Clazz.defineMethod(c$, "readString", +function(len){ +var nStyles = this.doc.readShort(); +len -= 2; +switch (nStyles) { +case 0: +break; +default: +this.skip(nStyles * 10); +len -= nStyles * 10; +break; +} +return this.doc.readString(len); +}, "~N"); +Clazz.defineMethod(c$, "readArray", +function(){ +var s = ""; +for (var i = this.doc.readShort(); --i >= 0; ) { +s += " " + this.doc.readInt(); +} +return s.trim(); +}); +Clazz.defineMethod(c$, "readLength", +function(){ +var len = this.doc.readShort(); +if (len == -1) { +len = this.doc.readInt(); +}return len; +}); +c$.toPoint = Clazz.defineMethod(c$, "toPoint", +function(i){ +return Math.round(i / 655.36) / 100.0; +}, "~N"); +c$.main = Clazz.defineMethod(c$, "main", +function(args){ +}, "~A"); +c$.fromString = Clazz.defineMethod(c$, "fromString", +function(vwr, type, mol){ +var htParams = new java.util.Hashtable(); +htParams.put("filter", "filetype=" + type); +var o; +try { +o = vwr.getModelAdapter().getAtomSetCollectionFromReader("", JU.Rdr.getBR(mol), htParams); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +e.printStackTrace(); +return null; +} else { +throw e; +} +} +if ((typeof(o)=='string')) { +return null; +}return J.adapter.writers.CDXMLWriter.fromASC(o); +}, "JV.Viewer,~S,~S"); +c$.cdxAttributes = Clazz.newArray(-1, ["HashSpacing", "2.50", "MarginWidth", "1.60", "LineWidth", "0.60", "BoldWidth", "2", "BondLength", "14.40", "BondSpacing", "18"]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/CIFWriter.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/CIFWriter.js new file mode 100755 index 000000000000..668de09b7d1f --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/CIFWriter.js @@ -0,0 +1,219 @@ +Clazz.declarePackage("J.adapter.writers"); +Clazz.load(["J.adapter.writers.XtlWriter", "J.api.JmolWriter", "JU.P3"], "J.adapter.writers.CIFWriter", ["JU.BS", "$.PT", "$.SB", "JV.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.vwr = null; +this.oc = null; +this.isP1 = false; +Clazz.instantialize(this, arguments);}, J.adapter.writers, "CIFWriter", J.adapter.writers.XtlWriter, J.api.JmolWriter); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.adapter.writers.CIFWriter, []); +}); +Clazz.overrideMethod(c$, "set", +function(viewer, oc, data){ +this.vwr = viewer; +this.oc = (oc == null ? this.vwr.getOutputChannel(null, null) : oc); +this.isP1 = (data != null && data.length > 0 && "P1".equals(data[0])); +}, "JV.Viewer,JU.OC,~A"); +Clazz.overrideMethod(c$, "write", +function(bs){ +if (bs == null) bs = this.vwr.bsA(); +try { +var mi = this.vwr.ms.at[bs.nextSetBit(0)].mi; +var uc = this.vwr.getCurrentUnitCell(); +this.haveUnitCell = (uc != null); +if (!this.haveUnitCell) uc = this.vwr.getSymTemp().setUnitCellFromParams(null, false, 0.00001); +this.slop = uc.getPrecision(); +this.isHighPrecision = (this.slop == 1.0E-12); +this.precision = Clazz.doubleToInt(-Math.log10(this.slop)); +var offset = uc.getFractionalOffset(); +var fractionalOffset = offset != null && (offset.x != Clazz.floatToInt(offset.x) || offset.y != Clazz.floatToInt(offset.y) || offset.z != Clazz.floatToInt(offset.z)); +var fset; +var haveCustom = (fractionalOffset || (fset = uc.getUnitCellMultiplier()) != null && (fset.z == 1 ? !fset.equals(J.adapter.writers.CIFWriter.fset0) : fset.z != 0)); +var ucm = uc.getUnitCellMultiplied(); +this.isP1 = (this.isP1 || ucm !== uc || fractionalOffset || uc.getSpaceGroupOperationCount() < 2); +uc = ucm; +var modelAU = (!this.haveUnitCell ? bs : this.isP1 ? uc.removeDuplicates(this.vwr.ms, bs, false) : this.vwr.ms.am[mi].bsAsymmetricUnit); +var bsOut; +if (modelAU == null) { +bsOut = bs; +} else { +bsOut = new JU.BS(); +bsOut.or(modelAU); +bsOut.and(bs); +}this.vwr.setErrorMessage(null, " (" + bsOut.cardinality() + " atoms)"); +if (bsOut.isEmpty()) return ""; +var sb = new JU.SB(); +sb.append("## CIF file created by Jmol " + JV.Viewer.getJmolVersion()); +if (haveCustom) { +sb.append(JU.PT.rep("\n" + uc.getUnitCellInfo(false), "\n", "\n##Jmol_orig ")); +}sb.append("\ndata_global"); +var params = uc.getUnitCellAsArray(false); +this.appendKey(sb, "_cell_length_a").append(this.cleanT(params[0])); +this.appendKey(sb, "_cell_length_b").append(this.cleanT(params[1])); +this.appendKey(sb, "_cell_length_c").append(this.cleanT(params[2])); +this.appendKey(sb, "_cell_angle_alpha").append(this.cleanT(params[3])); +this.appendKey(sb, "_cell_angle_beta").append(this.cleanT(params[4])); +this.appendKey(sb, "_cell_angle_gamma").append(this.cleanT(params[5])); +sb.append("\n"); +var n; +var hallName; +var hmName; +var ita; +if (this.isP1) { +ita = "1"; +hallName = "P 1"; +hmName = "P1"; +n = 0; +} else { +uc.getSpaceGroupInfo(this.vwr.ms, null, mi, true, null); +ita = uc.getSpaceGroupNameType("ITA"); +hallName = uc.getSpaceGroupNameType("Hall"); +hmName = uc.getSpaceGroupNameType("HM"); +n = uc.getSpaceGroupOperationCount(); +}this.appendKey(sb, "_space_group_IT_number").append(ita == null ? "?" : ita.toString()); +this.appendKey(sb, "_space_group_name_Hall").append(hallName == null || hallName.equals("?") ? "?" : "'" + hallName + "'"); +this.appendKey(sb, "_space_group_name_H-M_alt").append(hmName == null ? "?" : "'" + hmName + "'"); +sb.append("\n\nloop_\n_space_group_symop_id\n_space_group_symop_operation_xyz"); +if (n == 0) { +sb.append("\n1 x,y,z"); +} else { +for (var i = 0; i < n; i++) { +sb.append("\n").appendI(i + 1).append("\t").append(uc.getSpaceGroupXyz(i, false).replaceAll(" ", "")); +} +}var atoms = this.vwr.ms.at; +var elements = ""; +var haveOccupancy = false; +var occ = (this.haveUnitCell ? this.vwr.ms.occupancies : null); +if (occ != null) { +for (var i = bsOut.nextSetBit(0); i >= 0; i = bsOut.nextSetBit(i + 1)) { +if (occ[i] != 1) { +haveOccupancy = true; +break; +}} +}var haveAltLoc = false; +for (var i = bsOut.nextSetBit(0); i >= 0; i = bsOut.nextSetBit(i + 1)) { +if (atoms[i].altloc != '\0') { +haveAltLoc = true; +break; +}} +var sbLength = sb.length(); +sb.append("\n\nloop_\n_atom_site_label\n_atom_site_type_symbol\n_atom_site_fract_x\n_atom_site_fract_y\n_atom_site_fract_z"); +if (haveAltLoc) { +sb.append("\n_atom_site_disorder_group"); +}if (haveOccupancy) { +sb.append("\n_atom_site_occupancy"); +} else if (!this.haveUnitCell) { +sb.append("\n_atom_site_Cartn_x\n_atom_site_Cartn_y\n_atom_site_Cartn_z"); +}sb.append("\n"); +var jmol_atom = new JU.SB(); +jmol_atom.append("\n\nloop_\n_jmol_atom_index\n_jmol_atom_name\n_jmol_atom_site_label\n"); +var nAtoms = 0; +var p = new JU.P3(); +var elemNums = Clazz.newIntArray (130, 0); +for (var i = bsOut.nextSetBit(0); i >= 0; i = bsOut.nextSetBit(i + 1)) { +var a = atoms[i]; +p.setT(a); +if (this.haveUnitCell) { +uc.toFractional(p, !this.isP1); +}nAtoms++; +var name = a.getAtomName(); +var sym = a.getElementSymbol(); +var elemno = a.getElementNumber(); +var key = sym + "\n"; +if (elements.indexOf(key) < 0) elements += key; +var label = sym + ++elemNums[elemno]; +sb.append(JU.PT.formatS(label, 5, 0, true, false)).append(" ").append(JU.PT.formatS(sym, 3, 0, true, false)).append(this.clean(p.x)).append(this.clean(p.y)).append(this.clean(p.z)); +if (haveAltLoc) { +sb.append(" ").appendC(a.altloc == '\0' ? '.' : a.altloc); +}if (haveOccupancy) sb.append(" ").append(this.clean(occ[i] / 100)); + else if (!this.haveUnitCell) sb.append(this.clean(a.x)).append(this.clean(a.y)).append(this.clean(a.z)); +sb.append("\n"); +jmol_atom.append(JU.PT.formatS("" + a.getIndex(), 3, 0, false, false)).append(" "); +this.writeChecked(jmol_atom, name); +jmol_atom.append(" ").append(JU.PT.formatS(label, 5, 0, false, false)).append("\n"); +} +if (nAtoms > 0) { +sb.append("\nloop_\n_atom_type_symbol\n").append(elements).append("\n"); +sb.appendSB(jmol_atom); +} else { +sb.setLength(sbLength); +}sb.append("\n_jmol_atom_count " + nAtoms); +sb.append("\n_jmol_precision " + this.precision + "\n"); +this.oc.append(sb.toString()); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +if (!JV.Viewer.isJS) e.printStackTrace(); +} else { +throw e; +} +} +return this.toString(); +}, "JU.BS"); +Clazz.defineMethod(c$, "writeChecked", +function(output, val){ +if (val == null || val.length == 0) { +output.append(". "); +return false; +}var escape = val.charAt(0) == '_'; +var escapeCharStart = "'"; +var escapeCharEnd = "' "; +var hasWhitespace = false; +var hasSingle = false; +var hasDouble = false; +for (var i = 0; i < val.length; i++) { +var c = val.charAt(i); +switch ((c).charCodeAt(0)) { +case 9: +case 32: +hasWhitespace = true; +break; +case 10: +this.writeMultiline(output, val); +return true; +case 34: +if (hasSingle) { +this.writeMultiline(output, val); +return true; +}hasDouble = true; +escape = true; +escapeCharStart = "'"; +escapeCharEnd = "' "; +break; +case 39: +if (hasDouble) { +this.writeMultiline(output, val); +return true; +}escape = true; +hasSingle = true; +escapeCharStart = "\""; +escapeCharEnd = "\" "; +break; +} +} +var fst = val.charAt(0); +if (!escape && (fst == '#' || fst == '$' || fst == ';' || fst == '[' || fst == ']' || hasWhitespace)) { +escapeCharStart = "'"; +escapeCharEnd = "' "; +escape = true; +}if (escape) { +output.append(escapeCharStart).append(val).append(escapeCharEnd); +} else { +output.append(val).append(" "); +}return false; +}, "JU.SB,~S"); +Clazz.defineMethod(c$, "writeMultiline", +function(output, val){ +output.append("\n;").append(val).append("\n;\n"); +}, "JU.SB,~S"); +Clazz.defineMethod(c$, "appendKey", +function(sb, key){ +return sb.append("\n").append(JU.PT.formatS(key, 27, 0, true, false)); +}, "JU.SB,~S"); +Clazz.defineMethod(c$, "toString", +function(){ +return (this.oc == null ? "" : this.oc.toString()); +}); +c$.fset0 = JU.P3.new3(555, 555, 1); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/CMLWriter.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/CMLWriter.js new file mode 100755 index 000000000000..4f0b1a5c6fbf --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/CMLWriter.js @@ -0,0 +1,101 @@ +Clazz.declarePackage("J.adapter.writers"); +Clazz.load(["J.api.JmolWriter"], "J.adapter.writers.CMLWriter", ["JU.BS", "$.PT", "$.SB", "JU.Edge"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.vwr = null; +this.oc = null; +this.atomsMax = 0; +this.addBonds = false; +this.doTransform = false; +this.allTrajectories = false; +Clazz.instantialize(this, arguments);}, J.adapter.writers, "CMLWriter", null, J.api.JmolWriter); +/*LV!1824 unnec constructor*/Clazz.overrideMethod(c$, "set", +function(viewer, out, data){ +this.vwr = viewer; +this.oc = (this.oc == null ? this.vwr.getOutputChannel(null, null) : this.oc); +this.atomsMax = (data[0]).intValue(); +this.addBonds = (data[1]).booleanValue(); +this.doTransform = (data[2]).booleanValue(); +this.allTrajectories = (data[3]).booleanValue(); +}, "JV.Viewer,JU.OC,~A"); +Clazz.overrideMethod(c$, "write", +function(bs){ +var sb = new JU.SB(); +var nAtoms = bs.cardinality(); +if (nAtoms == 0) return ""; +J.adapter.writers.CMLWriter.openTag(sb, "molecule"); +J.adapter.writers.CMLWriter.openTag(sb, "atomArray"); +var bsAtoms = new JU.BS(); +var atoms = this.vwr.ms.at; +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { +if (--this.atomsMax < 0) break; +var atom = atoms[i]; +var name = atom.getAtomName(); +JU.PT.rep(name, "\"", "''"); +bsAtoms.set(atom.i); +J.adapter.writers.CMLWriter.appendEmptyTag(sb, "atom", Clazz.newArray(-1, ["id", "a" + (atom.i + 1), "title", atom.getAtomName(), "elementType", atom.getElementSymbol(), "x3", "" + atom.x, "y3", "" + atom.y, "z3", "" + atom.z])); +} +J.adapter.writers.CMLWriter.closeTag(sb, "atomArray"); +if (this.addBonds) { +J.adapter.writers.CMLWriter.openTag(sb, "bondArray"); +var bondCount = this.vwr.ms.bondCount; +var bonds = this.vwr.ms.bo; +for (var i = 0; i < bondCount; i++) { +var bond = bonds[i]; +var a1 = bond.atom1; +var a2 = bond.atom2; +if (!bsAtoms.get(a1.i) || !bsAtoms.get(a2.i)) continue; +var order = JU.Edge.getCmlBondOrder(bond.order); +if (order == null) continue; +J.adapter.writers.CMLWriter.appendEmptyTag(sb, "bond", Clazz.newArray(-1, ["atomRefs2", "a" + (bond.atom1.i + 1) + " a" + (bond.atom2.i + 1), "order", order])); +} +J.adapter.writers.CMLWriter.closeTag(sb, "bondArray"); +}J.adapter.writers.CMLWriter.closeTag(sb, "molecule"); +this.oc.append(sb.toString()); +return this.toString(); +}, "JU.BS"); +c$.openDocument = Clazz.defineMethod(c$, "openDocument", +function(sb){ +sb.append("\n"); +}, "JU.SB"); +c$.openTag = Clazz.defineMethod(c$, "openTag", +function(sb, name){ +sb.append("<").append(name).append(">\n"); +}, "JU.SB,~S"); +c$.startOpenTag = Clazz.defineMethod(c$, "startOpenTag", +function(sb, name){ +sb.append("<").append(name); +}, "JU.SB,~S"); +c$.terminateTag = Clazz.defineMethod(c$, "terminateTag", +function(sb){ +sb.append(">\n"); +}, "JU.SB"); +c$.terminateEmptyTag = Clazz.defineMethod(c$, "terminateEmptyTag", +function(sb){ +sb.append("/>\n"); +}, "JU.SB"); +c$.appendEmptyTag = Clazz.defineMethod(c$, "appendEmptyTag", +function(sb, name, attributes){ +J.adapter.writers.CMLWriter.startOpenTag(sb, name); +J.adapter.writers.CMLWriter.addAttributes(sb, attributes); +J.adapter.writers.CMLWriter.terminateEmptyTag(sb); +}, "JU.SB,~S,~A"); +c$.addAttributes = Clazz.defineMethod(c$, "addAttributes", +function(sb, attributes){ +for (var i = 0; i < attributes.length; i++) { +J.adapter.writers.CMLWriter.addAttribute(sb, attributes[i], attributes[++i]); +} +}, "JU.SB,~A"); +c$.addAttribute = Clazz.defineMethod(c$, "addAttribute", +function(sb, key, val){ +sb.append(" ").append(key).append("=").append(JU.PT.esc(val)); +}, "JU.SB,~S,~S"); +c$.closeTag = Clazz.defineMethod(c$, "closeTag", +function(sb, name){ +sb.append("").append(name).append(">\n"); +}, "JU.SB,~S"); +Clazz.overrideMethod(c$, "toString", +function(){ +return (this.oc == null ? "" : this.oc.toString()); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/MOLWriter.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/MOLWriter.js new file mode 100755 index 000000000000..baabf99ec14c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/MOLWriter.js @@ -0,0 +1,252 @@ +Clazz.declarePackage("J.adapter.writers"); +Clazz.load(null, "J.adapter.writers.MOLWriter", ["java.util.Arrays", "$.Hashtable", "JU.Lst", "$.Measure", "$.P3", "$.PT", "$.SB", "$.V3", "JS.T", "JU.Elements", "$.Escape", "JV.PropertyManager", "$.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.vwr = null; +this.ptTemp = null; +this.vNorm = null; +this.vTemp = null; +this.connections = null; +Clazz.instantialize(this, arguments);}, J.adapter.writers, "MOLWriter", null); +/*LV!1824 unnec constructor*/Clazz.defineMethod(c$, "setViewer", +function(vwr){ +this.vwr = vwr; +return this; +}, "JV.Viewer"); +Clazz.defineMethod(c$, "addMolFile", +function(title, iModel, mol, bsAtoms, bsBonds, asV3000, asJSON, noAromatic, q, is2d){ +var nAtoms = bsAtoms.cardinality(); +var nBonds = bsBonds.cardinality(); +if (!asV3000 && !asJSON && (nAtoms > 999 || nBonds > 999)) return false; +if (!asJSON) { +if (title.length > 80) title = title.substring(0, 77) + "..."; +mol.append(title).append("\n"); +var version = JV.Viewer.getJmolVersion(); +mol.append(JV.PropertyManager.getSDFDateLine("__Jmol-" + version, is2d)); +mol.append("Jmol version ").append(version).append(" EXTRACT: ").append(JU.Escape.eBS(bsAtoms)).append("\n"); +}var asSDF = (iModel >= 0); +var molData = (asSDF ? this.vwr.ms.getInfo(iModel, "molData") : null); +var _keyList = (asSDF ? this.vwr.ms.getInfo(iModel, "molDataKeys") : null); +var ms = this.vwr.ms; +var atomMap = Clazz.newIntArray (ms.ac, 0); +var pTemp = new JU.P3(); +if (asV3000) { +mol.append(" 0 0 0 0 0 0 999 V3000"); +} else if (asJSON) { +mol.append("{\"mol\":{\"createdBy\":\"Jmol " + JV.Viewer.getJmolVersion() + "\",\"a\":["); +} else { +JU.PT.rightJustify(mol, " ", "" + nAtoms); +JU.PT.rightJustify(mol, " ", "" + nBonds); +mol.append(" 0 0 0 0 999 V2000"); +}if (!asJSON) mol.append("\n"); +if (asV3000) { +mol.append("M V30 BEGIN CTAB\nM V30 COUNTS ").appendI(nAtoms).append(" ").appendI(nBonds).append(" 0 0 0\n").append("M V30 BEGIN ATOM\n"); +}var o = (molData == null ? null : molData.get("atom_value_name")); +if (Clazz.instanceOf(o,"JS.SV")) o = (o).asString(); +var valueType = (o == null ? 0 : JS.T.getTokFromName("" + o)); +var atomValues = (valueType == 0 && !asSDF ? null : new JU.SB()); +for (var i = bsAtoms.nextSetBit(0), n = 0; i >= 0; i = bsAtoms.nextSetBit(i + 1)) { +this.getAtomRecordMOL(iModel, ms, mol, atomMap[i] = ++n, ms.at[i], q, pTemp, asV3000, asJSON, atomValues, valueType, asSDF); +} +if (asV3000) { +mol.append("M V30 END ATOM\nM V30 BEGIN BOND\n"); +} else if (asJSON) { +mol.append("],\"b\":["); +}for (var i = bsBonds.nextSetBit(0), n = 0; i >= 0; i = bsBonds.nextSetBit(i + 1)) { +this.getBondRecordMOL(mol, ++n, ms.bo[i], atomMap, asV3000, asJSON, noAromatic, is2d); +} +if (asV3000) { +mol.append("M V30 END BOND\nM V30 END CTAB\n"); +}if (asJSON) mol.append("]}}"); + else { +if (atomValues != null && atomValues.length() > 0) mol.append(atomValues.toString()); +mol.append("M END\n"); +}if (asSDF) { +try { +var pc = ms.getPartialCharges(); +if (molData == null) molData = new java.util.Hashtable(); +var sb = new JU.SB(); +if (pc != null) { +sb.appendI(nAtoms).appendC('\n'); +for (var i = bsAtoms.nextSetBit(0), n = 0; i >= 0; i = bsAtoms.nextSetBit(i + 1)) sb.appendI(++n).append(" ").appendF(pc[i]).appendC('\n'); + +molData.put("jmol_partial_charges", sb.toString()); +}sb.setLength(0); +sb.appendI(nAtoms).appendC('\n'); +for (var i = bsAtoms.nextSetBit(0), n = 0; i >= 0; i = bsAtoms.nextSetBit(i + 1)) { +var name = ms.at[i].getAtomName().trim(); +if (name.length == 0) name = "."; +sb.appendI(++n).append(" ").append(name.$replace(' ', '_')).appendC('\n'); +} +molData.put("jmol_atom_names", sb.toString()); +if (_keyList == null) _keyList = new JU.Lst(); +for (var key, $key = molData.keySet().iterator (); $key.hasNext()&& ((key = $key.next ()) || true);) if (!_keyList.contains(key)) _keyList.addLast(key); + +for (var i = 0, n = _keyList.size(); i < n; i++) { +var key = _keyList.get(i); +if (key.startsWith(">")) continue; +o = molData.get(key); +if (Clazz.instanceOf(o,"JS.SV")) o = (o).asString(); +mol.append("> <" + key.toUpperCase() + ">\n"); +this.output80CharWrap(mol, o.toString(), 80); +mol.append("\n\n"); +} +} catch (e) { +} +mol.append("$$$$\n"); +}return true; +}, "~S,~N,JU.SB,JU.BS,JU.BS,~B,~B,~B,JU.Quat,~B"); +Clazz.defineMethod(c$, "getAtomRecordMOL", +function(iModel, ms, mol, n, a, q, pTemp, asV3000, asJSON, atomValues, tokValue, asSDF){ +ms.getPointTransf(iModel, a, q, pTemp); +var elemNo = a.getElementNumber(); +var sym = (a.isDeleted() ? "Xx" : JU.Elements.elementSymbolFromNumber(elemNo)); +var isotope = a.getIsotopeNumber(); +var charge = a.getFormalCharge(); +var o = Clazz.newArray(-1, [pTemp]); +if (asV3000) { +mol.append("M V30 ").appendI(n).append(" ").append(sym).append(JU.PT.sprintf(" %12.5p %12.5p %12.5p 0", "p", o)); +if (charge != 0) mol.append(" CHG=").appendI(charge); +if (isotope != 0) mol.append(" MASS=").appendI(isotope); +mol.append("\n"); +} else if (asJSON) { +if (n != 1) mol.append(","); +mol.append("{"); +if (a.getElementNumber() != 6) mol.append("\"l\":\"").append(a.getElementSymbol()).append("\","); +if (charge != 0) mol.append("\"c\":").appendI(charge).append(","); +if (isotope != 0) mol.append("\"m\":").appendI(isotope).append(","); +mol.append("\"x\":").appendF(a.x).append(",\"y\":").appendF(a.y).append(",\"z\":").appendF(a.z).append("}"); +} else { +mol.append(JU.PT.sprintf("%10.4p%10.4p%10.4p", "p", o)); +mol.append(" ").append(sym); +if (sym.length == 1) mol.append(" "); +JU.PT.rightJustify(mol, " ", "" + (isotope > 0 ? isotope - JU.Elements.getNaturalIsotope(a.getElementNumber()) : 0)); +if (asSDF && isotope > 0) { +atomValues.append("M ISO 1"); +JU.PT.rightJustify(atomValues, " ", "" + n); +JU.PT.rightJustify(atomValues, " ", "" + isotope); +atomValues.append("\n"); +}JU.PT.rightJustify(mol, " ", "" + (charge == 0 ? 0 : 4 - charge)); +mol.append(" ").append(this.getAtomParity(a)); +mol.append(" 0 0 0\n"); +var label = (tokValue == 0 || asV3000 ? null : this.getAtomPropertyAsString(a, tokValue)); +if (label != null && (label = label.trim()).length > 0) { +var sn = " " + n + " "; +atomValues.append("V ").append(sn.substring(sn.length - 4)); +this.output80CharWrap(atomValues, label, 73); +}}}, "~N,JM.ModelSet,JU.SB,~N,JM.Atom,JU.Quat,JU.P3,~B,~B,JU.SB,~N,~B"); +Clazz.defineMethod(c$, "getAtomParity", +function(a){ +if (a.getCovalentBondCount() == 4) { +if (this.connections == null) { +this.connections = Clazz.newIntArray (4, 0); +this.vTemp = new JU.V3(); +this.vNorm = new JU.V3(); +}var bonds = a.bonds; +var nH = 0; +for (var pt = 0, i = bonds.length; --i >= 0; ) { +if (bonds[i].isCovalent()) { +var b = bonds[i].getOtherAtom(a); +if (b.getAtomicAndIsotopeNumber() == 1) nH++; +this.connections[pt++] = b.i; +}} +if (nH < 3) { +java.util.Arrays.sort(this.connections); +var atoms = this.vwr.ms.at; +JU.Measure.getNormalThroughPoints(atoms[this.connections[0]], atoms[this.connections[1]], atoms[this.connections[2]], this.vNorm, this.vTemp); +this.vTemp.sub2(atoms[this.connections[3]], atoms[this.connections[0]]); +return (this.vTemp.dot(this.vNorm) > 0 ? "1" : "2"); +}}return "0"; +}, "JM.Atom"); +Clazz.defineMethod(c$, "getAtomPropertyAsString", +function(a, tok){ +switch (tok & 1136656384) { +case 1094713344: +var i = a.atomPropertyInt(tok); +return (tok == 1765808134 ? JU.PT.trim(JU.Escape.escapeColor(i), "[x]").toUpperCase() : "" + i); +case 1086324736: +return a.atomPropertyString(this.vwr, tok); +case 1111490560: +var f = a.atomPropertyFloat(this.vwr, tok, null); +return (Float.isNaN(f) ? null : "" + f); +default: +if (this.ptTemp == null) this.ptTemp = new JU.P3(); +a.atomPropertyTuple(this.vwr, tok, this.ptTemp); +return (this.ptTemp == null ? null : this.ptTemp.toString()); +} +}, "JM.Atom,~N"); +Clazz.defineMethod(c$, "getBondRecordMOL", +function(mol, n, b, atomMap, asV3000, asJSON, noAromatic, is2d){ +var a1 = atomMap[b.atom1.i]; +var a2 = atomMap[b.atom2.i]; +var order = b.getValence(); +var cfg = ""; +if (order > 3) order = 1; +if (is2d) { +if (asJSON) { +} else { +switch (b.order) { +case 1057: +cfg = (asV3000 ? " CFG=3" : " 4"); +break; +case 1025: +cfg = (asV3000 ? " CFG=1" : " 1"); +break; +case 1041: +cfg = (asV3000 ? " CFG=2" : " 3"); +break; +default: +cfg = " 0"; +break; +} +}}switch (b.order & 131071) { +case 515: +order = (asJSON ? -3 : 4); +break; +case 66: +order = (asJSON ? -3 : 5); +break; +case 513: +order = (asJSON || noAromatic ? 1 : 6); +break; +case 514: +order = (asJSON || noAromatic ? 2 : 7); +break; +case 33: +order = (asJSON ? -1 : 8); +break; +} +if (asV3000) { +mol.append("M V30 ").appendI(n).append(" ").appendI(order).append(" ").appendI(a1).append(" ").appendI(a2).append(cfg).appendC('\n'); +} else if (asJSON) { +if (n != 1) mol.append(","); +mol.append("{\"b\":").appendI(a1 - 1).append(",\"e\":").appendI(a2 - 1); +if (order != 1) { +mol.append(",\"o\":"); +if (order < 0) { +mol.appendF(-order / 2); +} else { +mol.appendI(order); +}}mol.append("}"); +} else { +JU.PT.rightJustify(mol, " ", "" + a1); +JU.PT.rightJustify(mol, " ", "" + a2); +mol.append(" ").appendI(order).append(cfg).append("\n"); +}}, "JU.SB,~N,JM.Bond,~A,~B,~B,~B,~B"); +Clazz.defineMethod(c$, "output80CharWrap", +function(mol, data, maxN){ +if (maxN < 80) data = JU.PT.rep(data, "\n", "|"); +var lines = JU.PT.split(JU.PT.trim(JU.PT.rep(data, "\n\n", "\n"), "\n"), "\n"); +for (var i = 0; i < lines.length; i++) this.outputLines(mol, lines[i], maxN); + +}, "JU.SB,~S,~N"); +Clazz.defineMethod(c$, "outputLines", +function(mol, data, maxN){ +var done = false; +for (var i = 0, n = data.length; i < n && !done; i += 80) { +mol.append(data.substring(i, Math.min(i + maxN, n))); +if (!(done = (maxN != 80)) && i + 80 < n) mol.append("+"); +mol.append("\n"); +} +}, "JU.SB,~S,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/PDBWriter.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/PDBWriter.js new file mode 100755 index 000000000000..5f840dba05ce --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/PDBWriter.js @@ -0,0 +1,177 @@ +Clazz.declarePackage("J.adapter.writers"); +Clazz.load(["J.api.JmolWriter"], "J.adapter.writers.PDBWriter", ["java.util.Arrays", "$.Date", "$.Hashtable", "JU.Lst", "$.P3", "$.PT", "JM.LabelToken", "JV.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.vwr = null; +this.oc = null; +this.isPQR = false; +this.doTransform = false; +this.allTrajectories = false; +Clazz.instantialize(this, arguments);}, J.adapter.writers, "PDBWriter", null, J.api.JmolWriter); +/*LV!1824 unnec constructor*/Clazz.overrideMethod(c$, "set", +function(viewer, oc, data){ +this.vwr = viewer; +this.oc = (oc == null ? this.vwr.getOutputChannel(null, null) : oc); +this.isPQR = (data[0]).booleanValue(); +this.doTransform = (data[1]).booleanValue(); +this.allTrajectories = (data[2]).booleanValue(); +}, "JV.Viewer,JU.OC,~A"); +Clazz.overrideMethod(c$, "write", +function(bs){ +var type = this.oc.getType(); +this.isPQR = new Boolean (this.isPQR | (type != null && type.indexOf("PQR") >= 0)).valueOf(); +this.doTransform = new Boolean (this.doTransform | (type != null && type.indexOf("-coord true") >= 0)).valueOf(); +var atoms = this.vwr.ms.at; +var models = this.vwr.ms.am; +var occTemp = "%6.2Q%6.2b "; +if (this.isPQR) { +occTemp = "%8.4P%7.4V "; +var charge = 0; +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) charge += atoms[i].getPartialCharge(); + +this.oc.append("REMARK 1 PQR file generated by Jmol " + JV.Viewer.getJmolVersion()).append("\nREMARK 1 " + "created " + ( new java.util.Date())).append("\nREMARK 1 Forcefield Used: unknown\nREMARK 1").append("\nREMARK 5").append("\nREMARK 6 Total charge on this protein: " + charge + " e\nREMARK 6\n"); +}var iModel = atoms[bs.nextSetBit(0)].mi; +var iModelLast = -1; +var lastAtomIndex = bs.length() - 1; +var lastModelIndex = atoms[lastAtomIndex].mi; +var isMultipleModels = (iModel != lastModelIndex); +var bsModels = this.vwr.ms.getModelBS(bs, true); +var nModels = bsModels.cardinality(); +var lines = new JU.Lst(); +var isMultipleBondPDB = models[iModel].isPdbWithMultipleBonds; +var uniqueAtomNumbers = false; +if (nModels > 1) { +var conectArray = null; +for (var nFiles = 0, i = bsModels.nextSetBit(0); i >= 0; i = bsModels.nextSetBit(i + 1)) { +var a = this.vwr.ms.getModelAuxiliaryInfo(i).get("PDB_CONECT_bonds"); +if (a !== conectArray || !this.vwr.ms.am[i].isBioModel) { +conectArray = a; +if (nFiles++ > 0) { +uniqueAtomNumbers = true; +break; +}}} +}var tokens; +var ptTemp = new JU.P3(); +var o = Clazz.newArray(-1, [ptTemp]); +var q = (this.doTransform ? this.vwr.tm.getRotationQ() : null); +var map = new java.util.Hashtable(); +var isBiomodel = false; +var firstAtomIndexNew = (uniqueAtomNumbers ? Clazz.newIntArray (nModels, 0) : null); +var modelPt = 0; +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { +var a = atoms[i]; +isBiomodel = models[a.mi].isBioModel; +if (isMultipleModels && a.mi != iModelLast) { +if (iModelLast != -1) { +modelPt = this.fixPDBFormat(lines, map, this.oc, firstAtomIndexNew, modelPt); +this.oc.append("ENDMDL\n"); +}lines = new JU.Lst(); +iModel = iModelLast = a.mi; +this.oc.append("MODEL " + (iModelLast + 1) + "\n"); +}var sa = a.getAtomName(); +var leftJustify = (a.getElementSymbol().length == 2 || sa.length >= 4 || JU.PT.isDigit(sa.charAt(0))); +var isHetero = a.isHetero(); +if (!isBiomodel) tokens = (leftJustify ? JM.LabelToken.compile(this.vwr, "HETATM%5.-5i %-4.4a%1AUNK %1c 1%1E _XYZ_" + occTemp, '\0', null) : JM.LabelToken.compile(this.vwr, "HETATM%5.-5i %-3.3a%1AUNK %1c 1%1E _XYZ_" + occTemp, '\0', null)); + else if (isHetero) tokens = (leftJustify ? JM.LabelToken.compile(this.vwr, "HETATM%5.-5i %-4.4a%1A%3.3n %1c%4.-4R%1E _XYZ_" + occTemp, '\0', null) : JM.LabelToken.compile(this.vwr, "HETATM%5.-5i %-3.3a%1A%3.3n %1c%4.-4R%1E _XYZ_" + occTemp, '\0', null)); + else tokens = (leftJustify ? JM.LabelToken.compile(this.vwr, "ATOM %5.-5i %-4.4a%1A%3.3n %1c%4.-4R%1E _XYZ_" + occTemp, '\0', null) : JM.LabelToken.compile(this.vwr, "ATOM %5.-5i %-3.3a%1A%3.3n %1c%4.-4R%1E _XYZ_" + occTemp, '\0', null)); +var XX = a.getElementSymbolIso(false).toUpperCase(); +XX = this.pdbKey(a.group.getBioPolymerIndexInModel()) + this.pdbKey(a.group.groupIndex) + JM.LabelToken.formatLabelAtomArray(this.vwr, a, tokens, '\0', null, ptTemp) + (XX.length == 1 ? " " + XX : XX.substring(0, 2)) + " "; +this.vwr.ms.getPointTransf(-1, a, q, ptTemp); +var xyz = JU.PT.sprintf("%8.3p%8.3p%8.3p", "p", o); +if (xyz.length > 24) xyz = JU.PT.sprintf("%8.2p%8.2p%8.2p", "p", o); +XX = JU.PT.rep(XX, "_XYZ_", xyz); +lines.addLast(XX); +} +this.fixPDBFormat(lines, map, this.oc, firstAtomIndexNew, modelPt); +if (isMultipleModels) this.oc.append("ENDMDL\n"); +modelPt = -1; +iModelLast = -1; +var conectKey = "" + (isMultipleModels ? modelPt : 0); +isBiomodel = false; +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { +var a = atoms[i]; +if (a.mi != iModelLast) { +var m = models[a.mi]; +iModelLast = a.mi; +isBiomodel = m.isBioModel; +modelPt++; +}var isHetero = (!isBiomodel || a.isHetero()); +var isCysS = !isHetero && (a.getElementNumber() == 16); +if (isHetero || isMultipleBondPDB || isCysS) { +var bonds = a.bonds; +if (bonds == null) continue; +for (var j = 0; j < bonds.length; j++) { +var b = bonds[j]; +var iThis = a.getAtomNumber(); +var a2 = b.getOtherAtom(a); +if (!bs.get(a2.i)) continue; +var n = b.getCovalentOrder(); +if (n == 1 && (isMultipleBondPDB && !isHetero && !isCysS || isCysS && a2.getElementNumber() != 16)) continue; +var iOther = a2.getAtomNumber(); +switch (n) { +case 2: +case 3: +if (iOther < iThis) continue; +case 1: +var inew = map.get(conectKey + "." + Integer.$valueOf(iThis)); +var inew2 = map.get(conectKey + "." + Integer.$valueOf(iOther)); +if (inew == null || inew2 == null) break; +this.oc.append("CONECT").append(JU.PT.formatStringS("%5s", "s", "" + inew)); +var s = JU.PT.formatStringS("%5s", "s", "" + inew2); +for (var k = 0; k < n; k++) this.oc.append(s); + +this.oc.append("\n"); +break; +} +} +}} +return this.toString(); +}, "JU.BS"); +Clazz.defineMethod(c$, "pdbKey", +function(np){ +var xp = (np < 0 ? "~999" : " " + np); +return xp.substring(xp.length - 4); +}, "~N"); +Clazz.defineMethod(c$, "fixPDBFormat", +function(lines, map, out, firstAtomIndexNew, modelPt){ +lines.addLast("~999~999XXXXXX99999999999999999999~99~"); +var alines = new Array(lines.size()); +lines.toArray(alines); +java.util.Arrays.sort(alines); +lines.clear(); +for (var i = 0, n = alines.length; i < n; i++) { +lines.addLast(alines[i]); +} +var lastPoly = null; +var lastLine = null; +var n = lines.size(); +var newAtomNumber = 0; +var iBase = (firstAtomIndexNew == null ? 0 : firstAtomIndexNew[modelPt]); +for (var i = 0; i < n; i++) { +var s = lines.get(i); +var poly = s.substring(0, 4); +s = s.substring(8); +var isTerm = false; +var isLast = (s.indexOf("~99~") >= 0); +if (!poly.equals(lastPoly) || isLast) { +if (lastPoly != null && !lastPoly.equals("~999")) { +isTerm = true; +s = "TER " + lastLine.substring(6, 11) + " " + lastLine.substring(17, 27); +lines.add(i, poly + "~~~~" + s); +n++; +}lastPoly = poly; +}if (isLast && !isTerm) break; +lastLine = s; +newAtomNumber = i + 1 + iBase; +if (map != null && !isTerm) map.put("" + modelPt + "." + Integer.$valueOf(JU.PT.parseInt(s.substring(6, 11))), Integer.$valueOf(newAtomNumber)); +var si = " " + newAtomNumber; +out.append(s.substring(0, 6)).append(si.substring(si.length - 5)).append(s.substring(11)).append("\n"); +} +if (firstAtomIndexNew != null && ++modelPt < firstAtomIndexNew.length) firstAtomIndexNew[modelPt] = newAtomNumber; +return modelPt; +}, "JU.Lst,java.util.Map,JU.OC,~A,~N"); +Clazz.overrideMethod(c$, "toString", +function(){ +return (this.oc == null ? "" : this.oc.toString()); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/PWMATWriter.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/PWMATWriter.js new file mode 100755 index 000000000000..7a83092e2fba --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/PWMATWriter.js @@ -0,0 +1,186 @@ +Clazz.declarePackage("J.adapter.writers"); +Clazz.load(["J.adapter.writers.XtlWriter", "J.api.JmolWriter"], "J.adapter.writers.PWMATWriter", ["JU.P3", "$.PT", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.vwr = null; +this.oc = null; +this.uc = null; +this.names = null; +this.bs = null; +this.isSlab = false; +this.writeGlobals = false; +Clazz.instantialize(this, arguments);}, J.adapter.writers, "PWMATWriter", J.adapter.writers.XtlWriter, J.api.JmolWriter); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.adapter.writers.PWMATWriter, []); +this.isHighPrecision = true; +}); +Clazz.overrideMethod(c$, "set", +function(viewer, oc, data){ +this.vwr = viewer; +this.isSlab = (data != null && data[0] != null && data[0].equals("slab")); +this.oc = (oc == null ? this.vwr.getOutputChannel(null, null) : oc); +}, "JV.Viewer,JU.OC,~A"); +Clazz.overrideMethod(c$, "write", +function(bs){ +if (bs == null) bs = this.vwr.bsA(); +try { +this.uc = this.vwr.ms.getUnitCellForAtom(bs.nextSetBit(0)); +this.bs = (this.isSlab ? bs : this.uc.removeDuplicates(this.vwr.ms, bs, false)); +this.names = this.vwr.getDataObj("property_pwm_*", null, -1); +this.writeHeader(); +this.writeLattice(); +this.writePositions(); +this.writeDataBlocks(); +if (this.writeGlobals) this.writeGlobalBlocks(); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +System.err.println("Error writing PWmat file " + e); +} else { +throw e; +} +} +return this.toString(); +}, "JU.BS"); +Clazz.defineMethod(c$, "writeHeader", +function(){ +this.oc.append(JU.PT.formatStringI("%12i\n", "i", this.bs.cardinality())); +}); +Clazz.defineMethod(c$, "writeLattice", +function(){ +this.oc.append("Lattice vector\n"); +if (this.uc == null) { +this.uc = this.vwr.getSymTemp(); +var bb = this.vwr.getBoundBoxCornerVector(); +var len = Math.round(bb.length() * 2); +this.uc.setUnitCellFromParams( Clazz.newFloatArray(-1, [len, len, len, 90, 90, 90]), false, 1.0E-12); +}var abc = this.uc.getUnitCellVectors(); +var f = "%18.10p%18.10p%18.10p\n"; +this.oc.append(JU.PT.sprintf(f, "p", Clazz.newArray(-1, [abc[1]]))); +this.oc.append(JU.PT.sprintf(f, "p", Clazz.newArray(-1, [abc[2]]))); +this.oc.append(JU.PT.sprintf(f, "p", Clazz.newArray(-1, [abc[3]]))); +JU.Logger.info("PWMATWriter: LATTICE VECTORS"); +}); +Clazz.defineMethod(c$, "writePositions", +function(){ +var cx = this.getData("CONSTRAINTS_X"); +var cy = (cx == null ? null : this.getData("CONSTRAINTS_Y")); +var cz = (cy == null ? null : this.getData("CONSTRAINTS_Z")); +this.oc.append("Position, move_x, move_y, move_z\n"); +var f = "%4i%40s" + (cz == null ? " 1 1 1" : "%4i%4i%4i") + "\n"; +var a = this.vwr.ms.at; +var p = new JU.P3(); +for (var ic = 0, i = this.bs.nextSetBit(0); i >= 0; i = this.bs.nextSetBit(i + 1), ic++) { +p.setT(a[i]); +this.uc.toFractional(p, false); +var coord = this.clean(p.x) + this.clean(p.y) + this.clean(p.z); +if (cz == null) { +this.oc.append(JU.PT.sprintf(f, "is", Clazz.newArray(-1, [Integer.$valueOf(a[i].getElementNumber()), coord]))); +} else { +var ix = Clazz.floatToInt(cx[ic]); +var iy = Clazz.floatToInt(cy[ic]); +var iz = Clazz.floatToInt(cz[ic]); +this.oc.append(JU.PT.sprintf(f, "isiii", Clazz.newArray(-1, [Integer.$valueOf(a[i].getElementNumber()), coord, Integer.$valueOf(ix), Integer.$valueOf(iy), Integer.$valueOf(iz)]))); +}} +JU.Logger.info("PWMATWriter: POSITIONS"); +}); +Clazz.defineMethod(c$, "getData", +function(name){ +name = "property_pwm_" + name.toLowerCase(); +for (var i = this.names.size(); --i >= 0; ) { +var n = this.names.get(i); +if (name.equalsIgnoreCase(n)) { +this.names.removeItemAt(i); +return this.vwr.getDataObj(n, this.bs, 1); +}} +return null; +}, "~S"); +Clazz.defineMethod(c$, "getVectors", +function(name){ +var vectors = Clazz.newArray(-1, [this.getData(name + "_x"), this.getData(name + "_y"), this.getData(name + "_z")]); +return (vectors[0] == null || vectors[1] == null || vectors[2] == null ? null : vectors); +}, "~S"); +Clazz.defineMethod(c$, "writeDataBlocks", +function(){ +this.writeVectors("FORCE"); +this.writeVectors("VELOCITY"); +this.writeMagnetic(); +this.writeMoreData(); +}); +Clazz.defineMethod(c$, "writeVectors", +function(name){ +var xyz = this.getVectors(name); +if (xyz == null) return; +var a = this.vwr.ms.at; +var p = new JU.P3(); +this.oc.append(name.toUpperCase()).append("\n"); +var f = "%4i%18.12p%18.12p%18.12p\n"; +for (var ic = 0, i = this.bs.nextSetBit(0); i >= 0; i = this.bs.nextSetBit(i + 1), ic++) { +p.set(xyz[0][ic], xyz[1][ic], xyz[2][ic]); +this.oc.append(JU.PT.sprintf(f, "ip", Clazz.newArray(-1, [Integer.$valueOf(a[i].getElementNumber()), p]))); +} +JU.Logger.info("PWMATWriter: " + name); +}, "~S"); +Clazz.defineMethod(c$, "writeMagnetic", +function(){ +var m = this.writeItems("MAGNETIC"); +if (m == null) return; +this.writeItem2(m, "CONSTRAINT_MAG"); +}); +Clazz.defineMethod(c$, "writeItem2", +function(m, name){ +var v = this.getData(name); +if (v == null) return; +var a = this.vwr.ms.at; +this.oc.append(name.toUpperCase()).append("\n"); +var f = "%4i%18.12f%18.12f\n"; +for (var ic = 0, i = this.bs.nextSetBit(0); i >= 0; i = this.bs.nextSetBit(i + 1), ic++) { +this.oc.append(JU.PT.sprintf(f, "iff", Clazz.newArray(-1, [Integer.$valueOf(a[i].getElementNumber()), Float.$valueOf(m[ic]), Float.$valueOf(v[ic])]))); +} +}, "~A,~S"); +Clazz.defineMethod(c$, "writeItems", +function(name){ +var m = this.getData(name); +if (m == null) return null; +var a = this.vwr.ms.at; +name = name.toUpperCase(); +this.oc.append(name).append("\n"); +var f = "%4i%18.12f\n"; +for (var ic = 0, i = this.bs.nextSetBit(0); i >= 0; i = this.bs.nextSetBit(i + 1), ic++) { +this.oc.append(JU.PT.sprintf(f, "if", Clazz.newArray(-1, [Integer.$valueOf(a[i].getElementNumber()), Float.$valueOf(m[ic])]))); +} +JU.Logger.info("PWMATWriter: " + name); +return m; +}, "~S"); +Clazz.defineMethod(c$, "writeMoreData", +function(){ +var n = this.names.size(); +var i0 = 0; +while (this.names.size() > i0 && --n >= 0) { +var name = this.names.get(i0).substring(13); +System.out.println(name); +if (name.endsWith("_y") || name.endsWith("_z")) { +i0++; +continue; +}if (name.endsWith("_x")) { +this.writeVectors(name.substring(0, name.length - 2)); +i0 = 0; +} else { +this.writeItems(name); +}} +}); +Clazz.defineMethod(c$, "writeGlobalBlocks", +function(){ +var globals = this.vwr.getModelForAtomIndex(this.bs.nextSetBit(0)).auxiliaryInfo.get("globalPWmatData"); +if (globals != null) for (var e, $e = globals.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) { +this.oc.append(e.getKey()).append("\n"); +var lines = e.getValue(); +for (var i = 0; i < lines.length; i++) this.oc.append(lines[i]).append("\n"); + +} +}); +Clazz.overrideMethod(c$, "toString", +function(){ +return (this.oc == null ? "" : this.oc.toString()); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/QCJSONWriter.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/QCJSONWriter.js new file mode 100755 index 000000000000..99472ce8fa5b --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/QCJSONWriter.js @@ -0,0 +1,468 @@ +Clazz.declarePackage("J.adapter.writers"); +Clazz.load(["JU.SB", "J.api.JmolWriter", "JU.JSONWriter", "java.util.Hashtable"], "J.adapter.writers.QCJSONWriter", ["java.util.Date", "JU.DF", "$.P3", "$.PT", "org.qcschema.QCSchemaUnits"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.moBases = null; +this.htBasisMap = null; +this.filterMOs = false; +this.vwr = null; +this.basisID = 0; +this.shells = null; +this.dfCoefMaps = null; +if (!Clazz.isClassDefined("J.adapter.writers.QCJSONWriter.SparseArray")) { +J.adapter.writers.QCJSONWriter.$QCJSONWriter$SparseArray$ (); +} +Clazz.instantialize(this, arguments);}, J.adapter.writers, "QCJSONWriter", JU.JSONWriter, J.api.JmolWriter); +Clazz.prepareFields (c$, function(){ +this.moBases = new java.util.Hashtable(); +this.htBasisMap = new java.util.Hashtable(); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.adapter.writers.QCJSONWriter, []); +}); +Clazz.overrideMethod(c$, "set", +function(viewer, oc, data){ +this.vwr = viewer; +this.oc = (oc == null ? this.vwr.getOutputChannel(null, null) : oc); +this.setWriteNullAsString(false); +this.setStream(oc); +}, "JV.Viewer,JU.OC,~A"); +Clazz.overrideMethod(c$, "write", +function(bs){ +this.writeJSON(); +return this.toString(); +}, "JU.BS"); +Clazz.defineMethod(c$, "toString", +function(){ +return (this.oc == null ? "{}" : this.oc.toString()); +}); +Clazz.defineMethod(c$, "writeJSON", +function(){ +this.openSchema(); +this.writeMagic(); +this.oc.append(",\n"); +this.writeSchemaMetadata(); +this.writeJobs(); +this.closeSchema(); +}); +Clazz.defineMethod(c$, "writeSchemaMetadata", +function(){ +this.mapOpen(); +this.mapAddKeyValue("__jmol_created", new java.util.Date(), ",\n"); +this.mapAddKeyValue("__jmol_source", this.vwr.getP("_modelFile"), ""); +this.mapClose(); +}); +Clazz.defineMethod(c$, "openSchema", +function(){ +this.arrayOpen(false); +}); +Clazz.defineMethod(c$, "writeMagic", +function(){ +this.writeString(org.qcschema.QCSchemaUnits.version); +}); +Clazz.defineMethod(c$, "closeSchema", +function(){ +this.oc.append("\n"); +this.arrayClose(false); +this.closeStream(); +}); +Clazz.defineMethod(c$, "writeJobs", +function(){ +this.writeJob(1); +}); +Clazz.defineMethod(c$, "writeJob", +function(iJob){ +this.append(",\n"); +this.mapOpen(); +{ +this.mapAddKeyValue("__jmol_block", "Job " + iJob, ",\n"); +this.writeJobMetadata(); +this.writeModels(); +this.writeMOBases(); +}this.mapClose(); +}, "~N"); +Clazz.defineMethod(c$, "writeJobMetadata", +function(){ +this.mapAddKey("metadata"); +this.mapOpen(); +{ +this.mapAddMapAllExcept("__jmol_info", this.vwr.getModelSetAuxiliaryInfo(), ";group3Counts;properties;group3Lists;models;unitCellParams;"); +}this.mapClose(); +}); +Clazz.defineMethod(c$, "writeModels", +function(){ +var nModels = this.vwr.ms.mc; +this.oc.append(",\n"); +this.mapAddKey("steps"); +this.arrayOpen(true); +{ +this.oc.append("\n"); +for (var i = 0; i < nModels; ) { +if (i > 0) this.append(",\n"); +i = this.writeModel(i); +} +}this.arrayClose(true); +}); +Clazz.defineMethod(c$, "writeModel", +function(modelIndex){ +var nextModel = modelIndex + 1; +this.append(""); +this.mapOpen(); +{ +this.mapAddKeyValue("__jmol_block", "Model " + (modelIndex + 1), ",\n"); +this.writeTopology(modelIndex); +if (this.isVibration(modelIndex)) { +this.oc.append(",\n"); +nextModel = this.writeVibrations(modelIndex); +}if (this.haveMOData(modelIndex)) { +this.oc.append(",\n"); +this.writeMOData(modelIndex); +}this.oc.append(",\n"); +this.writeModelMetadata(modelIndex); +}this.mapClose(); +this.oc.append("\n"); +return nextModel; +}, "~N"); +Clazz.defineMethod(c$, "writeTopology", +function(modelIndex){ +this.mapAddKey("topology"); +this.mapOpen(); +{ +this.writeAtoms(modelIndex); +this.writeBonds(modelIndex); +}this.mapClose(); +}, "~N"); +Clazz.defineMethod(c$, "getProperty", +function(modelIndex, key){ +var props = (modelIndex >= this.vwr.ms.am.length ? null : this.vwr.ms.am[modelIndex].auxiliaryInfo.get("modelProperties")); +return (props == null ? null : props.get(key)); +}, "~N,~S"); +Clazz.defineMethod(c$, "isVibration", +function(modelIndex){ +return (this.vwr.ms.getLastVibrationVector(modelIndex, 0) >= 0); +}, "~N"); +Clazz.defineMethod(c$, "writeModelMetadata", +function(modelIndex){ +this.mapAddKey("metadata"); +this.mapOpen(); +{ +this.mapAddMapAllExcept("__jmol_info", this.vwr.ms.am[modelIndex].auxiliaryInfo, ";.PATH;PATH;fileName;moData;unitCellParams;"); +}this.mapClose(); +}, "~N"); +Clazz.defineMethod(c$, "writeAtoms", +function(modelIndex){ +var symbols = Clazz.innerTypeInstance(J.adapter.writers.QCJSONWriter.SparseArray, this, null, "_RLE_"); +var numbers = Clazz.innerTypeInstance(J.adapter.writers.QCJSONWriter.SparseArray, this, null, "_RLE_"); +var charges = Clazz.innerTypeInstance(J.adapter.writers.QCJSONWriter.SparseArray, this, null, "_RLE_"); +var names = Clazz.innerTypeInstance(J.adapter.writers.QCJSONWriter.SparseArray, this, null, "_RLE_"); +var types = Clazz.innerTypeInstance(J.adapter.writers.QCJSONWriter.SparseArray, this, null, "_RLE_"); +this.mapAddKey("atoms"); +this.mapOpen(); +{ +var unitCell = this.vwr.ms.getUnitCell(modelIndex); +var isFractional = (unitCell != null && !unitCell.isBio()); +if (isFractional) { +var params = unitCell.getUnitCellAsArray(false); +this.writePrefix_Units("unit_cell", "angstroms"); +this.mapAddKeyValue("unit_cell", params, ",\n"); +}this.writePrefix_Units("coords", isFractional ? "fractional" : "angstroms"); +this.mapAddKey("coords"); +this.arrayOpen(true); +{ +this.oc.append("\n"); +var bs = this.vwr.getModelUndeletedAtomsBitSet(modelIndex); +var last = bs.length() - 1; +var pt = new JU.P3(); +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { +var a = this.vwr.ms.at[i]; +this.append(""); +pt.setT(a); +if (isFractional) unitCell.toFractional(pt, false); +this.oc.append(this.formatNumber(pt.x)).append(",\t").append(this.formatNumber(pt.y)).append(",\t").append(this.formatNumber(pt.z)).append(i < last ? ",\n" : "\n"); +symbols.add(JU.PT.esc(a.getElementSymbol())); +numbers.add("" + a.getElementNumber()); +charges.add("" + a.getPartialCharge()); +var name = a.getAtomName(); +names.add(name); +var type = a.getAtomType(); +types.add(type.equals(name) ? null : type); +} +}this.arrayClose(true); +this.oc.append(",\n"); +if (charges.isNumericAndNonZero()) { +this.mapAddKeyValueRaw("charge", charges, ",\n"); +}if (types.hasValues()) { +this.mapAddKeyValueRaw("types", types, ",\n"); +}this.mapAddKeyValueRaw("symbol", symbols, ",\n"); +this.mapAddKeyValueRaw("atom_number", numbers, "\n"); +}this.mapClose(); +}, "~N"); +Clazz.defineMethod(c$, "formatNumber", +function(x){ +return (x < 0 ? "" : " ") + JU.DF.formatDecimal(x, -6); +}, "~N"); +Clazz.defineMethod(c$, "writePrefix_Units", +function(prefix, units){ +this.mapAddKeyValueRaw(prefix + "_units", org.qcschema.QCSchemaUnits.getUnitsJSON(units, false), ",\n"); +}, "~S,~S"); +Clazz.defineMethod(c$, "writeBonds", +function(modelIndex){ +}, "~N"); +Clazz.defineMethod(c$, "writeVibrations", +function(modelIndex){ +this.mapAddKey("vibrations"); +this.arrayOpen(true); +{ +this.oc.append("\n"); +var sep = null; +var ivib = 0; +modelIndex--; +while (this.isVibration(++modelIndex)) { +if (sep != null) this.oc.append(sep); +sep = ",\n"; +this.append(""); +this.mapOpen(); +{ +this.mapAddKeyValue("__jmol_block", "Vibration " + (++ivib), ",\n"); +var value = this.getProperty(modelIndex, "FreqValue"); +var freq = this.getProperty(modelIndex, "Frequency"); +var intensity = this.getProperty(modelIndex, "IRIntensity"); +var tokens; +if (value == null) { +System.out.println("model " + modelIndex + " has no _M.properties.FreqValue"); +}if (freq == null) { +System.out.println("model " + modelIndex + " has no _M.properties.Frequency"); +} else { +tokens = JU.PT.split(freq, " "); +if (tokens.length == 1) { +System.out.println("model " + modelIndex + " has no frequency units"); +}this.writeMapKeyValueUnits("frequency", value, tokens[1]); +}if (intensity != null) { +tokens = JU.PT.split(intensity, " "); +this.writeMapKeyValueUnits("ir_intensity", tokens[0], tokens[1]); +}var label = this.getProperty(modelIndex, "FrequencyLabel"); +if (label != null) this.mapAddKeyValue("label", label, ",\n"); +this.mapAddKey("vectors"); +this.arrayOpen(true); +{ +this.oc.append("\n"); +var bs = this.vwr.getModelUndeletedAtomsBitSet(modelIndex); +var last = bs.length() - 1; +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { +var a = this.vwr.ms.at[i]; +var v = a.getVibrationVector(); +this.append(""); +this.oc.append(this.formatNumber(v.x)).append(",\t").append(this.formatNumber(v.y)).append(",\t").append(this.formatNumber(v.z)).append(i < last ? ",\n" : "\n"); +} +}this.arrayClose(true); +}this.append(""); +this.mapClose(); +} +}this.oc.append("\n"); +this.arrayClose(true); +return modelIndex; +}, "~N"); +Clazz.defineMethod(c$, "writeMapKeyValueUnits", +function(key, value, units){ +this.mapAddKeyValueRaw(key, "{\"value\":" + value + ",\"units\":" + org.qcschema.QCSchemaUnits.getUnitsJSON(units, false) + "}", ",\n"); +}, "~S,~O,~S"); +Clazz.defineMethod(c$, "haveMOData", +function(modelIndex){ +return (this.getAuxiliaryData(modelIndex, "moData") != null); +}, "~N"); +Clazz.defineMethod(c$, "getAuxiliaryData", +function(modelIndex, key){ +return this.vwr.ms.am[modelIndex].auxiliaryInfo.get(key); +}, "~N,~S"); +Clazz.defineMethod(c$, "writeMOData", +function(modelIndex){ +var moData = this.getAuxiliaryData(modelIndex, "moData"); +var moDataJSON = new java.util.Hashtable(); +moDataJSON.put("orbitals", moData.get("mos")); +var units = moData.get("EnergyUnits"); +if (units == null) units = "?"; +moDataJSON.put("orbitals_energy_units", org.qcschema.QCSchemaUnits.getUnitsJSON(units, true)); +moDataJSON.put("__jmol_normalized", Boolean.$valueOf(moData.get("isNormalized") === Boolean.TRUE)); +var type = moData.get("calculationType"); +moDataJSON.put("__jmol_calculation_type", type == null ? "?" : type); +this.setDFCoord(moData); +moDataJSON.put("basis_id", this.addBasis(moData)); +this.filterMOs = true; +this.setModifyKeys(J.adapter.writers.QCJSONWriter.fixIntegration()); +this.mapAddKeyValue("molecular_orbitals", moDataJSON, "\n"); +this.setModifyKeys(null); +this.filterMOs = false; +this.append(""); +}, "~N"); +c$.fixIntegration = Clazz.defineMethod(c$, "fixIntegration", +function(){ +if (J.adapter.writers.QCJSONWriter.integrationKeyMap == null) { +J.adapter.writers.QCJSONWriter.integrationKeyMap = new java.util.Hashtable(); +J.adapter.writers.QCJSONWriter.integrationKeyMap.put("integration", "__jmol_integration"); +}return J.adapter.writers.QCJSONWriter.integrationKeyMap; +}); +Clazz.overrideMethod(c$, "getAndCheckValue", +function(map, key){ +if (this.filterMOs) { +if (key.equals("dfCoefMaps")) return null; +if (key.equals("symmetry")) return (map.get(key)).$replace('_', ' ').trim(); +if (key.equals("coefficients") && this.dfCoefMaps != null) { +return this.fixCoefficients(map.get(key)); +}}return map.get(key); +}, "java.util.Map,~S"); +Clazz.defineMethod(c$, "fixCoefficients", +function(coeffs){ +var c = Clazz.newDoubleArray (coeffs.length, 0); +for (var i = 0, n = this.shells.size(); i < n; i++) { +var shell = this.shells.get(i); +var type = shell[1]; +var map = this.dfCoefMaps[type]; +for (var j = 0, coefPtr = 0; j < map.length; j++, coefPtr++) c[coefPtr + j] = coeffs[coefPtr + map[j]]; + +} +return c; +}, "~A"); +Clazz.defineMethod(c$, "setDFCoord", +function(moData){ +this.dfCoefMaps = moData.get("dfCoefMaps"); +if (this.dfCoefMaps != null) { +var haveMap = false; +for (var i = 0; !haveMap && i < this.dfCoefMaps.length; i++) { +var m = this.dfCoefMaps[i]; +for (var j = 0; j < m.length; j++) if (m[j] != 0) { +haveMap = true; +break; +} +} +if (!haveMap) this.dfCoefMaps = null; +}}, "java.util.Map"); +Clazz.defineMethod(c$, "addBasis", +function(moData){ +var hash = 1; +var gaussians = moData.get("gaussians"); +if (gaussians != null) { +hash ^= gaussians.hashCode(); +}this.shells = moData.get("shells"); +if (this.shells != null) { +hash ^= this.shells.hashCode(); +}var slaters = moData.get("slaters"); +if (slaters != null) { +hash ^= slaters.hashCode(); +}var strHash = "" + hash; +var key = this.htBasisMap.get(strHash); +if (key == null) { +this.htBasisMap.put(strHash, key = "MOBASIS_" + ++this.basisID); +var map = new java.util.Hashtable(); +if (gaussians != null) map.put("gaussians", gaussians); +if (this.shells != null) { +map.put("shells", this.shells); +}if (slaters != null) map.put("slaters", slaters); +this.moBases.put(key, map); +}return key; +}, "java.util.Map"); +Clazz.defineMethod(c$, "writeMOBases", +function(){ +if (this.moBases.isEmpty()) return; +this.oc.append(",\n"); +this.mapAddKey("mo_bases"); +this.mapOpen(); +{ +var sep = null; +for (var key, $key = this.moBases.keySet().iterator (); $key.hasNext()&& ((key = $key.next ()) || true);) { +if (key.startsWith("!")) continue; +this.append(sep); +this.mapAddKeyValue(key, this.moBases.get(key), "\n"); +sep = ",\n"; +} +}this.mapClose(); +this.moBases.clear(); +}); +Clazz.defineMethod(c$, "writeObject", +function(o){ +if (Clazz.instanceOf(o,"J.quantum.SlaterData")) { +this.oc.append(o.toString()); +} else { +Clazz.superCall(this, J.adapter.writers.QCJSONWriter, "writeObject", [o]); +}}, "~O"); +c$.$QCJSONWriter$SparseArray$ = function(){ +/*if4*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +Clazz.prepareCallback(this, arguments); +this.repeatCount = 0; +this.elementCount = 0; +this.$lastElement = null; +this.sep = ""; +this.type = null; +this.isRLE = false; +Clazz.instantialize(this, arguments);}, J.adapter.writers.QCJSONWriter, "SparseArray", JU.SB); +Clazz.makeConstructor(c$, +function(type){ +Clazz.superConstructor (this, J.adapter.writers.QCJSONWriter.SparseArray, []); +this.type = type; +this.isRLE = (type.equals("_RLE_")); +}, "~S"); +Clazz.defineMethod(c$, "add", +function(element){ +if (element == null) element = "null"; +if (!this.isRLE) { +this.append(this.sep); +this.append(element); +this.sep = ","; +return; +}if (this.repeatCount > 0 && !element.equals(this.$lastElement)) { +this.append(this.sep); +this.appendI(this.repeatCount); +this.sep = ","; +this.append(this.sep); +this.append(this.$lastElement); +this.repeatCount = 0; +}this.$lastElement = element; +this.repeatCount++; +this.elementCount++; +}, "~S"); +Clazz.defineMethod(c$, "lastElement", +function(){ +return this.$lastElement; +}); +Clazz.defineMethod(c$, "isEmpty", +function(){ +return (this.elementCount == 0); +}); +Clazz.defineMethod(c$, "allNaN", +function(){ +return (this.allSame() && JU.PT.parseFloat(this.$lastElement) == NaN); +}); +Clazz.defineMethod(c$, "allNull", +function(){ +return (this.allSame() && this.$lastElement.equals("null")); +}); +Clazz.defineMethod(c$, "allEmptyString", +function(){ +return (this.allSame() && this.$lastElement.equals("")); +}); +Clazz.defineMethod(c$, "allSame", +function(){ +return (!this.isEmpty() && this.elementCount == this.repeatCount); +}); +Clazz.defineMethod(c$, "allZero", +function(){ +return (this.allSame() && JU.PT.parseFloat(this.$lastElement) != NaN); +}); +Clazz.defineMethod(c$, "hasValues", +function(){ +return (!this.allSame() || !this.allNull() && !this.allEmptyString()); +}); +Clazz.defineMethod(c$, "isNumericAndNonZero", +function(){ +return (this.allSame() && !this.allNaN() && !this.allZero()); +}); +Clazz.defineMethod(c$, "toString", +function(){ +var s = Clazz.superCall(this, J.adapter.writers.QCJSONWriter.SparseArray, "toString", []); +return (s.length == 0 ? "[]" : "[\"" + this.type + "\"," + s + (this.repeatCount > 0 ? this.sep + this.repeatCount + "," + this.$lastElement : "") + "]"); +}); +/*eoif4*/})(); +}; +c$.integrationKeyMap = null; +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/XSFWriter.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/XSFWriter.js new file mode 100755 index 000000000000..a2786dad656c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/XSFWriter.js @@ -0,0 +1,69 @@ +Clazz.declarePackage("J.adapter.writers"); +Clazz.load(["J.api.JmolWriter"], "J.adapter.writers.XSFWriter", ["JU.PT"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.vwr = null; +this.oc = null; +this.uc = null; +this.len = 0; +Clazz.instantialize(this, arguments);}, J.adapter.writers, "XSFWriter", null, J.api.JmolWriter); +/*LV!1824 unnec constructor*/Clazz.overrideMethod(c$, "set", +function(viewer, oc, data){ +this.vwr = viewer; +this.oc = (oc == null ? this.vwr.getOutputChannel(null, null) : oc); +}, "JV.Viewer,JU.OC,~A"); +Clazz.overrideMethod(c$, "write", +function(bs){ +if (bs == null) bs = this.vwr.bsA(); +this.len = bs.length(); +if (this.len == 0) return ""; +try { +var a = this.vwr.ms.at; +var i0 = bs.nextSetBit(0); +this.uc = this.vwr.ms.getUnitCellForAtom(i0); +var model1 = a[i0].getModelIndex(); +var model2 = a[this.len - 1].getModelIndex(); +var isAnim = (model2 != model1); +if (isAnim) { +var nModels = this.vwr.ms.getModelBS(bs, false).cardinality(); +this.oc.append("ANIMSTEPS " + nModels + "\n"); +}if (this.uc != null) this.oc.append("CRYSTAL\n"); +var f = "%4i%18.12p%18.12p%18.12p\n"; +var prefix = (this.uc == null ? "ATOMS" : "PRIMCOORD"); +for (var lastmi = -1, imodel = 0, i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { +var atom = a[i]; +var mi = atom.getModelIndex(); +if (mi != lastmi) { +var sn = (isAnim ? " " + (++imodel) : ""); +var header = prefix + sn + "\n"; +this.uc = this.vwr.ms.getUnitCellForAtom(i); +if (this.uc == null) { +this.oc.append(header); +} else { +this.writeLattice(sn); +this.oc.append(header); +var bsm = this.vwr.restrictToModel(bs, mi); +this.oc.append(JU.PT.formatStringI("%6i 1\n", "i", bsm.cardinality())); +}lastmi = mi; +}this.oc.append(JU.PT.sprintf(f, "ip", Clazz.newArray(-1, [Integer.$valueOf(atom.getElementNumber()), atom]))); +} +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +return this.toString(); +}, "JU.BS"); +Clazz.defineMethod(c$, "writeLattice", +function(sn){ +var abc = this.uc.getUnitCellVectors(); +var f = "%18.10p%18.10p%18.10p\n"; +var s = JU.PT.sprintf(f, "p", Clazz.newArray(-1, [abc[1]])) + JU.PT.sprintf(f, "p", Clazz.newArray(-1, [abc[2]])) + JU.PT.sprintf(f, "p", Clazz.newArray(-1, [abc[3]])); +this.oc.append("PRIMVEC" + sn + "\n").append(s).append("CONVVEC" + sn + "\n").append(s); +}, "~S"); +Clazz.overrideMethod(c$, "toString", +function(){ +return (this.oc == null ? "" : this.oc.toString()); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/XtlWriter.js b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/XtlWriter.js new file mode 100755 index 000000000000..e226b45e2082 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/adapter/writers/XtlWriter.js @@ -0,0 +1,53 @@ +Clazz.declarePackage("J.adapter.writers"); +Clazz.load(null, "J.adapter.writers.XtlWriter", ["JU.PT"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.haveUnitCell = true; +this.isHighPrecision = true; +this.slop = 0; +this.precision = 0; +Clazz.instantialize(this, arguments);}, J.adapter.writers, "XtlWriter", null); +Clazz.defineMethod(c$, "clean", +function(d){ +if (!this.isHighPrecision) return this.cleanF(d); +var t; +return (!this.haveUnitCell || (t = J.adapter.writers.XtlWriter.twelfthsOf(d)) < 0 ? JU.PT.formatF(d, 18, 12, false, false) : (d < 0 ? " -" : " ") + J.adapter.writers.XtlWriter.twelfths[t]); +}, "~N"); +c$.twelfthsOf = Clazz.defineMethod(c$, "twelfthsOf", +function(f){ +if (f == 0) return 0; +f = Math.abs(f * 12); +var i = Math.round(f); +return (i <= 12 && Math.abs(f - i) < J.adapter.writers.XtlWriter.SLOPD * 12 ? i : -1); +}, "~N"); +Clazz.defineMethod(c$, "cleanF", +function(f){ +var t; +if (this.slop != 0) return this.cleanSlop(f); +return (!this.haveUnitCell || (t = J.adapter.writers.XtlWriter.twelfthsOfF(f)) < 0 ? JU.PT.formatF(f, 12, 7, false, false) : (f < 0 ? " -" : " ") + J.adapter.writers.XtlWriter.twelfthsF[t]); +}, "~N"); +Clazz.defineMethod(c$, "cleanSlop", +function(f){ +return JU.PT.formatF(f, this.precision + 6, this.precision, false, false); +}, "~N"); +c$.twelfthsOfF = Clazz.defineMethod(c$, "twelfthsOfF", +function(f){ +if (f == 0) return 0; +f = Math.abs(f * 12); +var i = Math.round(f); +return (i <= 12 && Math.abs(f - i) < J.adapter.writers.XtlWriter.SLOPF * 12 ? i : -1); +}, "~N"); +Clazz.defineMethod(c$, "cleanT", +function(d){ +var s = this.clean(d); +if (this.isHighPrecision) return s; +var i = s.length; +while (--i >= 2 && s.charAt(i) == '0' && s.charAt(i - 1) != '.') { +} +return s.substring(0, i + 1); +}, "~N"); +c$.SLOPD = 0.000000000010; +c$.SLOPF = 0.0000010; +c$.twelfths = Clazz.newArray(-1, ["0.000000000000", "0.083333333333", "0.166666666667", "0.250000000000", "0.333333333333", "0.416666666667", "0.500000000000", "0.583333333333", "0.666666666667", "0.750000000000", "0.833333333333", "0.916666666667", "1.000000000000"]); +c$.twelfthsF = Clazz.newArray(-1, ["0.0000000", "0.0833333", "0.1666667", "0.2500000", "0.3333333", "0.4166667", "0.5000000", "0.5833333", "0.6666667", "0.7500000", "0.8333333", "0.9166667", "1.0000000"]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/AtomIndexIterator.js b/config/plugins/visualizations/jmol/static/j2s/J/api/AtomIndexIterator.js new file mode 100755 index 000000000000..ef9ba3f961e3 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/AtomIndexIterator.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "AtomIndexIterator"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/EventManager.js b/config/plugins/visualizations/jmol/static/j2s/J/api/EventManager.js new file mode 100755 index 000000000000..af6fe18aa780 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/EventManager.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "EventManager"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/FontManager.js b/config/plugins/visualizations/jmol/static/j2s/J/api/FontManager.js new file mode 100755 index 000000000000..4dfb6dca0524 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/FontManager.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "FontManager"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/GenericFileInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/GenericFileInterface.js new file mode 100755 index 000000000000..cd49d0b119cb --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/GenericFileInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "GenericFileInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/GenericGraphics.js b/config/plugins/visualizations/jmol/static/j2s/J/api/GenericGraphics.js new file mode 100755 index 000000000000..95f2e81446f6 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/GenericGraphics.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "GenericGraphics"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/GenericImageDialog.js b/config/plugins/visualizations/jmol/static/j2s/J/api/GenericImageDialog.js new file mode 100755 index 000000000000..88fe29beafe2 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/GenericImageDialog.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "GenericImageDialog"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/GenericMenuInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/GenericMenuInterface.js new file mode 100755 index 000000000000..75e3e50e7869 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/GenericMenuInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "GenericMenuInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/GenericMouseInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/GenericMouseInterface.js new file mode 100755 index 000000000000..de3dd80f6730 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/GenericMouseInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "GenericMouseInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/GenericPlatform.js b/config/plugins/visualizations/jmol/static/j2s/J/api/GenericPlatform.js new file mode 100755 index 000000000000..a6a14d17cae5 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/GenericPlatform.js @@ -0,0 +1,5 @@ +Clazz.declarePackage("J.api"); +Clazz.load(["J.api.FontManager"], "J.api.GenericPlatform", null, function(){ +var c$ = Clazz.declareInterface(J.api, "GenericPlatform", J.api.FontManager); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/Interface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/Interface.js new file mode 100755 index 000000000000..817ca2cf62af --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/Interface.js @@ -0,0 +1,31 @@ +Clazz.declarePackage("J.api"); +Clazz.load(null, "J.api.Interface", ["JU.Logger"], function(){ +var c$ = Clazz.declareType(J.api, "Interface", null); +c$.getInterface = Clazz.defineMethod(c$, "getInterface", +function(name, vwr, state){ +try { +var x = Clazz._4Name(name); +return (x == null ? null : x.newInstance()); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.error("Interface.java Error creating instance for " + name + ": \n" + e); +return null; +} else { +throw e; +} +} +}, "~S,JV.Viewer,~S"); +c$.getOption = Clazz.defineMethod(c$, "getOption", +function(className, vwr, state){ +return J.api.Interface.getInterface("J." + className, vwr, state); +}, "~S,JV.Viewer,~S"); +c$.getUtil = Clazz.defineMethod(c$, "getUtil", +function(name, vwr, state){ +return J.api.Interface.getInterface("JU." + name, vwr, state); +}, "~S,JV.Viewer,~S"); +c$.getSymmetry = Clazz.defineMethod(c$, "getSymmetry", +function(vwr, state){ +return J.api.Interface.getInterface("JS.Symmetry", vwr, state); +}, "JV.Viewer,~S"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JSVInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JSVInterface.js new file mode 100755 index 000000000000..e8286be15ee9 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JSVInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JSVInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAbstractButton.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAbstractButton.js new file mode 100755 index 000000000000..230c6172f485 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAbstractButton.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolAbstractButton"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAdapter.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAdapter.js new file mode 100755 index 000000000000..5a970dfed349 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAdapter.js @@ -0,0 +1,52 @@ +Clazz.declarePackage("J.api"); +Clazz.load(null, "J.api.JmolAdapter", ["JU.PT", "J.api.JmolViewer", "JU.Elements"], function(){ +var c$ = Clazz.declareType(J.api, "JmolAdapter", null); +c$.getElementSymbol = Clazz.defineMethod(c$, "getElementSymbol", +function(elementNumber){ +return JU.Elements.elementSymbolFromNumber(elementNumber); +}, "~N"); +c$.getElementNumber = Clazz.defineMethod(c$, "getElementNumber", +function(elementSymbol){ +return JU.Elements.elementNumberFromSymbol(elementSymbol, false); +}, "~S"); +c$.getNaturalIsotope = Clazz.defineMethod(c$, "getNaturalIsotope", +function(elementNumber){ +return JU.Elements.getNaturalIsotope(elementNumber); +}, "~N"); +c$.getBondingRadius = Clazz.defineMethod(c$, "getBondingRadius", +function(atomicNumberWithIsotope, charge){ +return JU.Elements.getBondingRadius(atomicNumberWithIsotope, charge); +}, "~N,~N"); +Clazz.defineMethod(c$, "getAtomSetCollectionFromReaderType", +function(name, type, bufferedReader, htParams){ +var a = this.getAtomSetCollectionReader(name, type, bufferedReader, (J.api.JmolViewer.allocateViewer(null, this)).setLoadParameters(htParams, false)); +if ((typeof(a)=='string')) return a; +return this.getAtomSetCollection(a); +}, "~S,~S,~O,java.util.Map"); +Clazz.defineMethod(c$, "openBufferedReader", +function(name, bufferedReader){ +return this.getAtomSetCollectionFromReaderType(name, null, bufferedReader, null); +}, "~S,java.io.BufferedReader"); +Clazz.defineMethod(c$, "openBufferedReader", +function(name, bufferedReader, htParams){ +return this.getAtomSetCollectionFromReaderType(name, null, bufferedReader, htParams); +}, "~S,java.io.BufferedReader,java.util.Map"); +Clazz.defineMethod(c$, "openBufferedReader", +function(name, type, bufferedReader){ +return this.getAtomSetCollectionFromReaderType(name, type, bufferedReader, null); +}, "~S,~S,java.io.BufferedReader"); +c$.canonizeAlphaDigit = Clazz.defineMethod(c$, "canonizeAlphaDigit", +function(ch){ +return (JU.PT.isLetterOrDigit(ch) ? ch : '\0'); +}, "~S"); +c$.canonizeInsertionCode = Clazz.defineMethod(c$, "canonizeInsertionCode", +function(insertionCode){ +return J.api.JmolAdapter.canonizeAlphaDigit(insertionCode); +}, "~S"); +c$.canonizeAlternateLocationID = Clazz.defineMethod(c$, "canonizeAlternateLocationID", +function(altLoc){ +return J.api.JmolAdapter.canonizeAlphaDigit(altLoc); +}, "~S"); +c$.cellParamNames = Clazz.newArray(-1, ["_cell_length_a", "_cell_length_b", "_cell_length_c", "_cell_angle_alpha", "_cell_angle_beta", "_cell_angle_gamma"]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAdapterAtomIterator.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAdapterAtomIterator.js new file mode 100755 index 000000000000..ca7497ebb788 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAdapterAtomIterator.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolAdapterAtomIterator"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAdapterBondIterator.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAdapterBondIterator.js new file mode 100755 index 000000000000..f163aa233164 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAdapterBondIterator.js @@ -0,0 +1,5 @@ +Clazz.declarePackage("J.api"); +(function(){ +var c$ = Clazz.declareType(J.api, "JmolAdapterBondIterator", null); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAdapterStructureIterator.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAdapterStructureIterator.js new file mode 100755 index 000000000000..e2a51ddf1d2b --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAdapterStructureIterator.js @@ -0,0 +1,5 @@ +Clazz.declarePackage("J.api"); +(function(){ +var c$ = Clazz.declareType(J.api, "JmolAdapterStructureIterator", null); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAnnotationParser.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAnnotationParser.js new file mode 100755 index 000000000000..859ec05f9f33 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAnnotationParser.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolAnnotationParser"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAppAPI.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAppAPI.js new file mode 100755 index 000000000000..531ed31a4ba2 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAppAPI.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolAppAPI"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAppConsoleInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAppConsoleInterface.js new file mode 100755 index 000000000000..a140be61ad14 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAppConsoleInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolAppConsoleInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAppletInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAppletInterface.js new file mode 100755 index 000000000000..310e80e9d81c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAppletInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolAppletInterface", J.api.JmolSyncInterface); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAudioPlayer.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAudioPlayer.js new file mode 100755 index 000000000000..aa8890609073 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolAudioPlayer.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolAudioPlayer"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolCallbackListener.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolCallbackListener.js new file mode 100755 index 000000000000..09aa371b28a0 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolCallbackListener.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolCallbackListener"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolDataManager.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolDataManager.js new file mode 100755 index 000000000000..93676efd0f10 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolDataManager.js @@ -0,0 +1,5 @@ +Clazz.declarePackage("J.api"); +(function(){ +var c$ = Clazz.declareInterface(J.api, "JmolDataManager"); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolDialogInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolDialogInterface.js new file mode 100755 index 000000000000..8b594896fff6 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolDialogInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolDialogInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolDropEditor.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolDropEditor.js new file mode 100755 index 000000000000..db026c0b1ccb --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolDropEditor.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolDropEditor"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolEnvCalc.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolEnvCalc.js new file mode 100755 index 000000000000..c9a29b476841 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolEnvCalc.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolEnvCalc"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolFilesReaderInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolFilesReaderInterface.js new file mode 100755 index 000000000000..b77bcf1274e1 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolFilesReaderInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolFilesReaderInterface", Runnable); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolGestureServerInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolGestureServerInterface.js new file mode 100755 index 000000000000..3e371645b3e9 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolGestureServerInterface.js @@ -0,0 +1,5 @@ +Clazz.declarePackage("J.api"); +(function(){ +var c$ = Clazz.declareInterface(J.api, "JmolGestureServerInterface"); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolGraphicsInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolGraphicsInterface.js new file mode 100755 index 000000000000..3817ed490dd0 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolGraphicsInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolGraphicsInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolInChI.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolInChI.js new file mode 100755 index 000000000000..fc5cb21b044c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolInChI.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolInChI"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolJDXMOLParser.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolJDXMOLParser.js new file mode 100755 index 000000000000..0ba5cd63a79c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolJDXMOLParser.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolJDXMOLParser"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolJDXMOLReader.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolJDXMOLReader.js new file mode 100755 index 000000000000..eb4c74d501ad --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolJDXMOLReader.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolJDXMOLReader"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolJSpecView.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolJSpecView.js new file mode 100755 index 000000000000..e47dd118d426 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolJSpecView.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolJSpecView"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolMeasurementClient.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolMeasurementClient.js new file mode 100755 index 000000000000..d11b522d2ad0 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolMeasurementClient.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolMeasurementClient"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolModulationSet.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolModulationSet.js new file mode 100755 index 000000000000..0de82eedbeb8 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolModulationSet.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolModulationSet"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolMovieCreatorInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolMovieCreatorInterface.js new file mode 100755 index 000000000000..53b9a701cd50 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolMovieCreatorInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolMovieCreatorInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolNMRInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolNMRInterface.js new file mode 100755 index 000000000000..104a57d771cd --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolNMRInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolNMRInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolNavigatorInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolNavigatorInterface.js new file mode 100755 index 000000000000..602976d69778 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolNavigatorInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolNavigatorInterface", Runnable); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolParallelProcessor.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolParallelProcessor.js new file mode 100755 index 000000000000..d1db103b4484 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolParallelProcessor.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolParallelProcessor"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolPdfCreatorInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolPdfCreatorInterface.js new file mode 100755 index 000000000000..9ec369aab9a7 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolPdfCreatorInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolPdfCreatorInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolPropertyManager.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolPropertyManager.js new file mode 100755 index 000000000000..8b1d42cb1474 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolPropertyManager.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolPropertyManager"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolRendererInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolRendererInterface.js new file mode 100755 index 000000000000..b1ffac29bb53 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolRendererInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolRendererInterface", J.api.JmolGraphicsInterface); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolRepaintManager.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolRepaintManager.js new file mode 100755 index 000000000000..a26d4e09d2c0 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolRepaintManager.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolRepaintManager"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolSceneGenerator.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolSceneGenerator.js new file mode 100755 index 000000000000..6f283fb39dc6 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolSceneGenerator.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolSceneGenerator"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolScriptEditorInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolScriptEditorInterface.js new file mode 100755 index 000000000000..5d407c5ec45b --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolScriptEditorInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolScriptEditorInterface", J.api.JmolDropEditor); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolScriptEvaluator.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolScriptEvaluator.js new file mode 100755 index 000000000000..84deaf578701 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolScriptEvaluator.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolScriptEvaluator"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolScriptFunction.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolScriptFunction.js new file mode 100755 index 000000000000..e9723ee3ee32 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolScriptFunction.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolScriptFunction"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolScriptManager.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolScriptManager.js new file mode 100755 index 000000000000..a4e92f6d3021 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolScriptManager.js @@ -0,0 +1,5 @@ +Clazz.declarePackage("J.api"); +(function(){ +var c$ = Clazz.declareInterface(J.api, "JmolScriptManager"); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolSelectionListener.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolSelectionListener.js new file mode 100755 index 000000000000..195a4d790eb0 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolSelectionListener.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolSelectionListener"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolStatusListener.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolStatusListener.js new file mode 100755 index 000000000000..f5ee7da8122f --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolStatusListener.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolStatusListener", J.api.JmolCallbackListener); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolSyncInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolSyncInterface.js new file mode 100755 index 000000000000..73cc277436e4 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolSyncInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolSyncInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolTouchSimulatorInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolTouchSimulatorInterface.js new file mode 100755 index 000000000000..42042893360f --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolTouchSimulatorInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolTouchSimulatorInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolViewer.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolViewer.js new file mode 100755 index 000000000000..145f858dcf70 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolViewer.js @@ -0,0 +1,63 @@ +Clazz.declarePackage("J.api"); +Clazz.load(null, "J.api.JmolViewer", ["java.util.Hashtable", "JV.JC"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.menuStructure = null; +this.apiPlatform = null; +Clazz.instantialize(this, arguments);}, J.api, "JmolViewer", null); +c$.allocateViewer = Clazz.defineMethod(c$, "allocateViewer", +function(display, modelAdapter, fullName, documentBase, codeBase, commandOptions, statusListener, implementedPlatform){ +var info = new java.util.Hashtable(); +if (display != null) info.put("display", display); +if (modelAdapter != null) info.put("adapter", modelAdapter); +if (statusListener != null) info.put("statuslistener", statusListener); +if (implementedPlatform != null) info.put("platform", implementedPlatform); +if (commandOptions != null) info.put("options", commandOptions); +if (fullName != null) info.put("fullname", fullName); +if (documentBase != null) info.put("documentbase", documentBase); +if (codeBase != null) info.put("codebase", codeBase); +info.put("isApp", Boolean.TRUE); +return new JV.Viewer(info); +}, "~O,J.api.JmolAdapter,~S,java.net.URL,java.net.URL,~S,J.api.JmolStatusListener,J.api.GenericPlatform"); +c$.allocateViewer = Clazz.defineMethod(c$, "allocateViewer", +function(container, jmolAdapter){ +return J.api.JmolViewer.allocateViewer(container, jmolAdapter, null, null, null, null, null, null); +}, "~O,J.api.JmolAdapter"); +c$.allocateViewer = Clazz.defineMethod(c$, "allocateViewer", +function(display, modelAdapter, fullName, documentBase, codeBase, commandOptions, statusListener){ +return J.api.JmolViewer.allocateViewer(display, modelAdapter, fullName, documentBase, codeBase, commandOptions, statusListener, null); +}, "~O,J.api.JmolAdapter,~S,java.net.URL,java.net.URL,~S,J.api.JmolStatusListener"); +Clazz.defineMethod(c$, "setConsole", +function(console){ +this.getProperty("DATA_API", "getAppConsole", console); +}, "J.api.JmolAppConsoleInterface"); +c$.getJmolVersion = Clazz.defineMethod(c$, "getJmolVersion", +function(){ +return JV.Viewer.getJmolVersion(); +}); +c$.getJmolVersionNoDate = Clazz.defineMethod(c$, "getJmolVersionNoDate", +function(){ +return JV.JC.version; +}); +Clazz.defineMethod(c$, "openReader", +function(fullPathName, reader){ +return this.openReader(fullPathName == null ? "String" : fullPathName, null, reader); +}, "~S,~O"); +Clazz.defineMethod(c$, "openFileAsync", +function(fileName){ +this.openFileAsyncSpecial(fileName, 0); +}, "~S"); +Clazz.defineMethod(c$, "renderScreenImage", +function(g, currentSize, rectClip){ +this.apiPlatform.renderScreenImage(g, currentSize); +}, "~O,~O,~O"); +Clazz.defineMethod(c$, "runScriptCautiously", +function(script){ +return null; +}, "~S"); +Clazz.defineMethod(c$, "dispose", +function(){ +}); +{ +}{ +}}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolWriter.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolWriter.js new file mode 100755 index 000000000000..a19de06a9217 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolWriter.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolWriter"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/JmolZipUtilities.js b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolZipUtilities.js new file mode 100755 index 000000000000..6b704b75152a --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/JmolZipUtilities.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "JmolZipUtilities"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/PlatformViewer.js b/config/plugins/visualizations/jmol/static/j2s/J/api/PlatformViewer.js new file mode 100755 index 000000000000..a663e7b92bff --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/PlatformViewer.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "PlatformViewer"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/PymolAtomReader.js b/config/plugins/visualizations/jmol/static/j2s/J/api/PymolAtomReader.js new file mode 100755 index 000000000000..cdb3e92a8f11 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/PymolAtomReader.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "PymolAtomReader"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/SC.js b/config/plugins/visualizations/jmol/static/j2s/J/api/SC.js new file mode 100755 index 000000000000..363219457876 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/SC.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "SC"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/SmilesMatcherInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/SmilesMatcherInterface.js new file mode 100755 index 000000000000..a75863465eaa --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/SmilesMatcherInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "SmilesMatcherInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/SymmetryInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/SymmetryInterface.js new file mode 100755 index 000000000000..03b418a0bf07 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/SymmetryInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "SymmetryInterface"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/Translator.js b/config/plugins/visualizations/jmol/static/j2s/J/api/Translator.js new file mode 100755 index 000000000000..abcb60cb0919 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/Translator.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api"); +Clazz.declareInterface(J.api, "Translator"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/js/GenericConsoleTextArea.js b/config/plugins/visualizations/jmol/static/j2s/J/api/js/GenericConsoleTextArea.js new file mode 100755 index 000000000000..937133757c09 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/js/GenericConsoleTextArea.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api.js"); +Clazz.declareInterface(J.api.js, "GenericConsoleTextArea"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/js/JSConsole.js b/config/plugins/visualizations/jmol/static/j2s/J/api/js/JSConsole.js new file mode 100755 index 000000000000..72297327044c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/js/JSConsole.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api.js"); +Clazz.declareInterface(J.api.js, "JSConsole"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/js/JSmolAppletObject.js b/config/plugins/visualizations/jmol/static/j2s/J/api/js/JSmolAppletObject.js new file mode 100755 index 000000000000..e523fac88813 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/js/JSmolAppletObject.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api.js"); +Clazz.declareInterface(J.api.js, "JSmolAppletObject", javajs.api.js.JSAppletObject); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/api/js/JmolToJSmolInterface.js b/config/plugins/visualizations/jmol/static/j2s/J/api/js/JmolToJSmolInterface.js new file mode 100755 index 000000000000..4845cab94f20 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/api/js/JmolToJSmolInterface.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.api.js"); +Clazz.declareInterface(J.api.js, "JmolToJSmolInterface", javajs.api.js.J2SObjectInterface); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/appletjs/Jmol.js b/config/plugins/visualizations/jmol/static/j2s/J/appletjs/Jmol.js new file mode 100755 index 000000000000..564a8673c816 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/appletjs/Jmol.js @@ -0,0 +1,18 @@ +Clazz.declarePackage("J.appletjs"); +Clazz.load(["JU.GenericApplet"], "J.appletjs.Jmol", ["java.util.Hashtable"], function(){ +var c$ = Clazz.declareType(J.appletjs, "Jmol", JU.GenericApplet); +Clazz.makeConstructor(c$, +function(vwrOptions){ +Clazz.superConstructor (this, J.appletjs.Jmol, []); +this.htParams = new java.util.Hashtable(); +if (vwrOptions == null) vwrOptions = new java.util.Hashtable(); +this.vwrOptions = vwrOptions; +for (var entry, $entry = vwrOptions.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) this.htParams.put(entry.getKey().toLowerCase(), entry.getValue()); + +this.documentBase = "" + vwrOptions.get("documentBase"); +this.codeBase = "" + vwrOptions.get("codePath"); +JU.GenericApplet.isJS = true; +this.init(this); +}, "java.util.Map"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/atomdata/AtomData.js b/config/plugins/visualizations/jmol/static/j2s/J/atomdata/AtomData.js new file mode 100755 index 000000000000..dcb03a9aa89c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/atomdata/AtomData.js @@ -0,0 +1,39 @@ +Clazz.declarePackage("J.atomdata"); +Clazz.load(null, "J.atomdata.AtomData", ["JU.P3", "JU.BSUtil"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.programInfo = null; +this.fileName = null; +this.modelName = null; +this.modelIndex = 0; +this.bsSelected = null; +this.bsIgnored = null; +this.bsMolecules = null; +this.radiusData = null; +this.firstAtomIndex = 0; +this.firstModelIndex = 0; +this.lastModelIndex = 0; +this.hAtomRadius = 0; +this.atomIndex = null; +this.atoms = null; +this.xyz = null; +this.atomRadius = null; +this.atomicNumber = null; +this.atomMolecule = null; +this.hAtoms = null; +this.ac = 0; +this.hydrogenAtomCount = 0; +this.adpMode = 0; +Clazz.instantialize(this, arguments);}, J.atomdata, "AtomData", null); +/*LV!1824 unnec constructor*/Clazz.defineMethod(c$, "transformXYZ", +function(mat, bs){ +var p = new Array(this.xyz.length); +if (bs == null) bs = JU.BSUtil.newBitSet2(0, this.xyz.length); +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { +if (this.xyz[i] == null) continue; +p[i] = JU.P3.newP(this.xyz[i]); +mat.rotTrans(p[i]); +} +this.xyz = p; +}, "JU.M4,JU.BS"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/atomdata/AtomDataServer.js b/config/plugins/visualizations/jmol/static/j2s/J/atomdata/AtomDataServer.js new file mode 100755 index 000000000000..de7c53b088bd --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/atomdata/AtomDataServer.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.atomdata"); +Clazz.declareInterface(J.atomdata, "AtomDataServer"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/atomdata/RadiusData.js b/config/plugins/visualizations/jmol/static/j2s/J/atomdata/RadiusData.js new file mode 100755 index 000000000000..d3bc8e1936ed --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/atomdata/RadiusData.js @@ -0,0 +1,54 @@ +Clazz.declarePackage("J.atomdata"); +Clazz.load(["java.lang.Enum", "J.c.VDW"], "J.atomdata.RadiusData", ["JU.SB"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.info = null; +this.factorType = null; +this.vdwType = null; +this.value = NaN; +this.valueExtended = 0; +this.values = null; +Clazz.instantialize(this, arguments);}, J.atomdata, "RadiusData", null); +Clazz.prepareFields (c$, function(){ +this.factorType = J.atomdata.RadiusData.EnumType.ABSOLUTE; +this.vdwType = J.c.VDW.AUTO; +}); +Clazz.makeConstructor(c$, +function(values, value, factorType, vdwType){ +if (values != null) { +this.values = values; +this.value = 2147483647; +return; +}if (factorType == null) return; +this.factorType = factorType; +this.value = value; +if (vdwType != null) this.vdwType = vdwType; +}, "~A,~N,J.atomdata.RadiusData.EnumType,J.c.VDW"); +Clazz.overrideMethod(c$, "toString", +function(){ +if (Float.isNaN(this.value)) return ""; +var sb = new JU.SB(); +switch (this.factorType) { +case J.atomdata.RadiusData.EnumType.ABSOLUTE: +sb.appendF(this.value); +break; +case J.atomdata.RadiusData.EnumType.OFFSET: +sb.append(this.value > 0 ? "+" : "").appendF(this.value); +break; +case J.atomdata.RadiusData.EnumType.FACTOR: +sb.appendI(Clazz.floatToInt(this.value * 100)).append("%"); +if (this.vdwType !== J.c.VDW.AUTO) sb.append(this.vdwType.getVdwLabel()); +break; +case J.atomdata.RadiusData.EnumType.SCREEN: +sb.appendI(Clazz.floatToInt(this.value)); +} +return sb.toString(); +}); +/*if2*/;(function(){ +var c$ = Clazz.declareType(J.atomdata.RadiusData, "EnumType", Enum); +Clazz.defineEnumConstant(c$, "ABSOLUTE", 0, []); +Clazz.defineEnumConstant(c$, "OFFSET", 1, []); +Clazz.defineEnumConstant(c$, "FACTOR", 2, []); +Clazz.defineEnumConstant(c$, "SCREEN", 3, []); +/*eoif2*/})(); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/awtjs/Event.js b/config/plugins/visualizations/jmol/static/j2s/J/awtjs/Event.js new file mode 100755 index 000000000000..f8278e33d01e --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/awtjs/Event.js @@ -0,0 +1,5 @@ +Clazz.declarePackage("J.awtjs"); +(function(){ +var c$ = Clazz.declareType(J.awtjs, "Event", null); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/awtjs/Platform.js b/config/plugins/visualizations/jmol/static/j2s/J/awtjs/Platform.js new file mode 100755 index 000000000000..3a25595fa49d --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/awtjs/Platform.js @@ -0,0 +1,28 @@ +Clazz.declarePackage("J.awtjs"); +Clazz.load(["J.awtjs2d.Platform"], "J.awtjs.Platform", null, function(){ +var c$ = Clazz.declareType(J.awtjs, "Platform", J.awtjs2d.Platform); +Clazz.overrideMethod(c$, "drawImage", +function(g, img, x, y, width, height, isDTI){ +}, "~O,~O,~N,~N,~N,~N,~B"); +Clazz.overrideMethod(c$, "getTextPixels", +function(text, font3d, gObj, image, width, height, ascent){ +return null; +}, "~S,JU.Font,~O,~O,~N,~N,~N"); +Clazz.overrideMethod(c$, "getGraphics", +function(image){ +return null; +}, "~O"); +Clazz.overrideMethod(c$, "getStaticGraphics", +function(image, backgroundTransparent){ +return null; +}, "~O,~B"); +Clazz.overrideMethod(c$, "newBufferedImage", +function(image, w, h){ +return null; +}, "~O,~N,~N"); +Clazz.overrideMethod(c$, "newOffScreenImage", +function(w, h){ +return null; +}, "~N,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/awtjs/README.txt b/config/plugins/visualizations/jmol/static/j2s/J/awtjs/README.txt new file mode 100755 index 000000000000..7104fe73ab52 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/awtjs/README.txt @@ -0,0 +1,9 @@ +awtjs and awtjs.swing are minimal AWT/Swing-like +implementations used by Jmol and JSpecView to +provide consoles without any reference to AWT +or Swing. It is a relatively simple implementation +without many features. It does do the job for Jmol +and JSpecView, and it is very tight, but I don't +recommend it. + +Bob Hanson \ No newline at end of file diff --git a/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/Display.js b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/Display.js new file mode 100755 index 000000000000..d7e35794716f --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/Display.js @@ -0,0 +1,67 @@ +Clazz.declarePackage("J.awtjs2d"); +(function(){ +var c$ = Clazz.declareType(J.awtjs2d, "Display", null); +c$.getFullScreenDimensions = Clazz.defineMethod(c$, "getFullScreenDimensions", +function(canvas, widthHeight){ +{ +widthHeight[0] = canvas.width; +widthHeight[1] = canvas.height; +}}, "~O,~A"); +c$.hasFocus = Clazz.defineMethod(c$, "hasFocus", +function(canvas){ +{ +}return true; +}, "~O"); +c$.requestFocusInWindow = Clazz.defineMethod(c$, "requestFocusInWindow", +function(canvas){ +{ +}}, "~O"); +c$.renderScreenImage = Clazz.defineMethod(c$, "renderScreenImage", +function(vwr, g, size){ +{ +}}, "J.api.PlatformViewer,~O,~O"); +c$.prompt = Clazz.defineMethod(c$, "prompt", +function(label, data, list, asButtons){ +{ +var s = (data == null ? alert(label) : prompt(label, data)); +if (s != null)return s; +}return "null"; +}, "~S,~S,~A,~B"); +c$.convertPointFromScreen = Clazz.defineMethod(c$, "convertPointFromScreen", +function(canvas, ptTemp){ +{ +}}, "~O,JU.P3"); +c$.drawImage = Clazz.defineMethod(c$, "drawImage", +function(context, canvas, x, y, width, height, isDTI){ +{ +var buf8 = canvas.buf8; +var buf32 = canvas.buf32; +var n = canvas.width * canvas.height; +var di = 1; +if (isDTI) { +var diw = width % 2; +width = Math.floor(width/2); +di = Math.floor(canvas.width/width); +} +var dw = (canvas.width - width || x) * 4; +for (var i = 0, p = 0, j = x * 4; i < n;) { +buf8[j++] = (buf32[i] >> 16) & 0xFF; +buf8[j++] = (buf32[i] >> 8) & 0xFF; +buf8[j++] = buf32[i] & 0xFF; +buf8[j++] = 0xFF; +i += di; +if (++p%width==0) { +if (diw) { +i += 1; +buf8[j] = 0; +buf8[j+1] = 0; +buf8[j+2] = 0; +buf8[j+3] = 0; +} +j += dw; +} +} +context.putImageData(canvas.imgdata,0,0); +}}, "~O,~O,~N,~N,~N,~N,~B"); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/Image.js b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/Image.js new file mode 100755 index 000000000000..3578a86fbf4f --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/Image.js @@ -0,0 +1,53 @@ +Clazz.declarePackage("J.awtjs2d"); +Clazz.load(null, "J.awtjs2d.Image", ["J.awtjs2d.Platform"], function(){ +var c$ = Clazz.declareType(J.awtjs2d, "Image", null); +c$.getWidth = Clazz.defineMethod(c$, "getWidth", +function(canvas){ +{ +return (canvas.imageWidth ? canvas.imageWidth : canvas.width); +}}, "~O"); +c$.getHeight = Clazz.defineMethod(c$, "getHeight", +function(canvas){ +{ +return (canvas.imageHeight ? canvas.imageHeight : canvas.height); +}}, "~O"); +c$.grabPixels = Clazz.defineMethod(c$, "grabPixels", +function(context, width, height){ +var data = null; +{ +data = context.getImageData(0, 0, width, height).data; +}return J.awtjs2d.Image.toIntARGB(data); +}, "~O,~N,~N"); +c$.toIntARGB = Clazz.defineMethod(c$, "toIntARGB", +function(imgData){ +var n = Clazz.doubleToInt(imgData.length / 4); +var iData = Clazz.newIntArray (n, 0); +for (var i = 0, j = 0; i < n; ) { +iData[i++] = (imgData[j++] << 16) | (imgData[j++] << 8) | imgData[j++] | (imgData[j++] << 24); +} +return iData; +}, "~A"); +c$.getTextPixels = Clazz.defineMethod(c$, "getTextPixels", +function(text, font3d, context, width, height, ascent){ +{ +context.fillStyle = "#000000"; +context.fillRect(0, 0, width, height); +context.fillStyle = "#FFFFFF"; +context.font = font3d.font; +context.fillText(text, 0, ascent); +}return J.awtjs2d.Image.grabPixels(context, width, height); +}, "~S,JU.Font,~O,~N,~N,~N"); +c$.allocateRgbImage = Clazz.defineMethod(c$, "allocateRgbImage", +function(windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent, canvas){ +{ +if (canvas == null) +canvas = {width:windowWidth,height:windowHeight}; +canvas.buf32 = pBuffer; +}return canvas; +}, "~N,~N,~A,~N,~B,~O"); +c$.getImageDialog = Clazz.defineMethod(c$, "getImageDialog", +function(vwr, title, imageMap){ +return J.awtjs2d.Platform.Jmol().consoleGetImageDialog(vwr, title, imageMap); +}, "JV.Viewer,~S,java.util.Map"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSFile.js b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSFile.js new file mode 100755 index 000000000000..cd2db85abafb --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSFile.js @@ -0,0 +1,60 @@ +Clazz.declarePackage("J.awtjs2d"); +Clazz.load(["J.api.GenericFileInterface"], "J.awtjs2d.JSFile", ["JU.OC", "$.PT", "JV.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.name = null; +this.fullName = null; +Clazz.instantialize(this, arguments);}, J.awtjs2d, "JSFile", null, J.api.GenericFileInterface); +Clazz.makeConstructor(c$, +function(name){ +this.name = name.$replace('\\', '/'); +this.fullName = name; +if (!this.fullName.startsWith("/") && JU.OC.urlTypeIndex(name) < 0) this.fullName = JV.Viewer.jsDocumentBase + "/" + this.fullName; +this.fullName = JU.PT.rep(this.fullName, "/./", "/"); +name = name.substring(name.lastIndexOf("/") + 1); +}, "~S"); +c$.newFile = Clazz.defineMethod(c$, "newFile", +function(name){ +return new J.awtjs2d.JSFile(name); +}, "~S"); +Clazz.overrideMethod(c$, "getParentAsFile", +function(){ +var pt = this.fullName.lastIndexOf("/"); +return (pt < 0 ? null : new J.awtjs2d.JSFile(this.fullName.substring(0, pt))); +}); +Clazz.overrideMethod(c$, "getFullPath", +function(){ +return this.fullName; +}); +Clazz.overrideMethod(c$, "getName", +function(){ +return this.name; +}); +Clazz.overrideMethod(c$, "isDirectory", +function(){ +return this.fullName.endsWith("/"); +}); +Clazz.overrideMethod(c$, "length", +function(){ +return 0; +}); +c$.getURLContents = Clazz.defineMethod(c$, "getURLContents", +function(url, outputBytes, post){ +try { +var conn = url.openConnection(); +if (outputBytes != null) conn.outputBytes(outputBytes); + else if (post != null) conn.outputString(post); +return conn.getContents(); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +return e.toString(); +} else { +throw e; +} +} +}, "java.net.URL,~A,~S"); +Clazz.overrideMethod(c$, "toString", +function(){ +return this.fullName; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSFont.js b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSFont.js new file mode 100755 index 000000000000..f87a739eb4a4 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSFont.js @@ -0,0 +1,39 @@ +Clazz.declarePackage("J.awtjs2d"); +(function(){ +var c$ = Clazz.declareType(J.awtjs2d, "JSFont", null); +c$.newFont = Clazz.defineMethod(c$, "newFont", +function(fontFace, isBold, isItalic, fontSize, type){ +fontFace = (fontFace.equals("Monospaced") ? "Courier" : fontFace.startsWith("Sans") ? "Helvetica Neue, Sans-serif" : "Serif"); +return (isBold ? "bold " : "") + (isItalic ? "italic " : "") + fontSize + type + " " + fontFace; +}, "~S,~B,~B,~N,~S"); +c$.getFontMetrics = Clazz.defineMethod(c$, "getFontMetrics", +function(font, context){ +{ +if (context.font != font.font) { +context.font = font.font; +font.font = context.font; +context._fontAscent = Math.ceil(font.fontSize); //pt, not px +// the descent is actually (px - pt) +// but I know of no way of getting access to the drawn height +context._fontDescent = Math.ceil(font.fontSize * 0.25);//approx +} +}return context; +}, "JU.Font,~O"); +c$.getAscent = Clazz.defineMethod(c$, "getAscent", +function(context){ +{ +return Math.ceil(context._fontAscent); +}}, "~O"); +c$.getDescent = Clazz.defineMethod(c$, "getDescent", +function(context){ +{ +return Math.ceil(context._fontDescent); +}}, "~O"); +c$.stringWidth = Clazz.defineMethod(c$, "stringWidth", +function(font, context, text){ +{ +context.font = font.font; +return Math.ceil(context.measureText(text).width); +}}, "JU.Font,~O,~S"); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSJmolPopup.js b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSJmolPopup.js new file mode 100755 index 000000000000..59fcde4e76ce --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSJmolPopup.js @@ -0,0 +1,33 @@ +Clazz.declarePackage("J.awtjs2d"); +Clazz.load(["J.popup.JmolPopup"], "J.awtjs2d.JSJmolPopup", ["J.awtjs2d.JSPopupHelper"], function(){ +var c$ = Clazz.declareType(J.awtjs2d, "JSJmolPopup", J.popup.JmolPopup); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.awtjs2d.JSJmolPopup, []); +this.helper = new J.awtjs2d.JSPopupHelper(this); +}); +Clazz.overrideMethod(c$, "menuShowPopup", +function(popup, x, y){ +try { +(popup).show(this.isTainted ? this.vwr.html5Applet : null, x, y); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +this.isTainted = false; +}, "J.api.SC,~N,~N"); +Clazz.overrideMethod(c$, "getUnknownCheckBoxScriptToRun", +function(item, name, what, TF){ +return null; +}, "J.api.SC,~S,~S,~B"); +Clazz.overrideMethod(c$, "getImageIcon", +function(fileName){ +return null; +}, "~S"); +Clazz.overrideMethod(c$, "menuFocusCallback", +function(name, actionCommand, b){ +}, "~S,~S,~B"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSModelKitPopup.js b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSModelKitPopup.js new file mode 100755 index 000000000000..727b439b1421 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSModelKitPopup.js @@ -0,0 +1,41 @@ +Clazz.declarePackage("J.awtjs2d"); +Clazz.load(["J.modelkit.ModelKitPopup"], "J.awtjs2d.JSModelKitPopup", ["J.awtjs2d.JSPopupHelper"], function(){ +var c$ = Clazz.declareType(J.awtjs2d, "JSModelKitPopup", J.modelkit.ModelKitPopup); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.awtjs2d.JSModelKitPopup, []); +this.helper = new J.awtjs2d.JSPopupHelper(this); +}); +Clazz.overrideMethod(c$, "menuShowPopup", +function(popup, x, y){ +try { +(popup).show(this.isTainted ? this.vwr.html5Applet : null, x, y); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +this.isTainted = false; +}, "J.api.SC,~N,~N"); +Clazz.overrideMethod(c$, "menuHidePopup", +function(popup){ +try { +(popup).setVisible(false); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +}, "J.api.SC"); +Clazz.overrideMethod(c$, "getImageIcon", +function(fileName){ +return "J/modelkit/images/" + fileName; +}, "~S"); +Clazz.overrideMethod(c$, "menuCheckBoxCallback", +function(source){ +this.doMenuCheckBoxCallback(source); +}, "J.api.SC"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSPopupHelper.js b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSPopupHelper.js new file mode 100755 index 000000000000..a1c57f7d96f9 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JSPopupHelper.js @@ -0,0 +1,93 @@ +Clazz.declarePackage("J.awtjs2d"); +Clazz.load(["J.popup.PopupHelper"], "J.awtjs2d.JSPopupHelper", ["JS.ButtonGroup", "$.JCheckBoxMenuItem", "$.JMenu", "$.JMenuItem", "$.JPopupMenu", "$.JRadioButtonMenuItem"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.popup = null; +this.buttonGroup = null; +Clazz.instantialize(this, arguments);}, J.awtjs2d, "JSPopupHelper", null, J.popup.PopupHelper); +Clazz.makeConstructor(c$, +function(popup){ +this.popup = popup; +}, "J.popup.GenericPopup"); +Clazz.overrideMethod(c$, "menuCreatePopup", +function(name, applet){ +var j = new JS.JPopupMenu(name); +j.setInvoker(applet); +return j; +}, "~S,~O"); +Clazz.overrideMethod(c$, "getMenu", +function(name){ +var jm = new JS.JMenu(); +jm.setName(name); +return jm; +}, "~S"); +Clazz.overrideMethod(c$, "getMenuItem", +function(text){ +return new JS.JMenuItem(text); +}, "~S"); +Clazz.overrideMethod(c$, "getRadio", +function(name){ +return new JS.JRadioButtonMenuItem(); +}, "~S"); +Clazz.overrideMethod(c$, "getCheckBox", +function(name){ +return new JS.JCheckBoxMenuItem(); +}, "~S"); +Clazz.overrideMethod(c$, "menuAddButtonGroup", +function(item){ +if (item == null) { +if (this.buttonGroup != null && this.buttonGroup.getButtonCount() > 0) this.buttonGroup = null; +return; +}if (this.buttonGroup == null) this.buttonGroup = new JS.ButtonGroup(); +this.buttonGroup.add(item); +}, "J.api.SC"); +Clazz.overrideMethod(c$, "getItemType", +function(m){ +return (m).btnType; +}, "J.api.SC"); +Clazz.overrideMethod(c$, "menuInsertSubMenu", +function(menu, subMenu, index){ +(subMenu).setParent(menu); +}, "J.api.SC,J.api.SC,~N"); +Clazz.overrideMethod(c$, "getSwingComponent", +function(component){ +return component; +}, "~O"); +Clazz.overrideMethod(c$, "menuClearListeners", +function(menu){ +if (menu != null) (menu).disposeMenu(); +}, "J.api.SC"); +Clazz.defineMethod(c$, "itemStateChanged", +function(e){ +if (this.popup != null) this.popup.menuCheckBoxCallback(e.getSource()); +}, "java.awt.event.ItemEvent"); +Clazz.defineMethod(c$, "actionPerformed", +function(e){ +if (this.popup != null) this.popup.menuClickCallback(e.getSource(), e.getActionCommand()); +}, "java.awt.event.ActionEvent"); +Clazz.overrideMethod(c$, "getButtonGroup", +function(){ +return this.buttonGroup; +}); +Clazz.defineMethod(c$, "handleEvent", +function(e){ +var type = "" + e.getID(); +if (type === "mouseenter") this.mouseEntered(e); + else if (type === "mouseleave") this.mouseExited(e); +}, "java.awt.event.MouseEvent"); +Clazz.defineMethod(c$, "mouseEntered", +function(e){ +var jmi = e.getSource(); +this.popup.menuFocusCallback(jmi.getName(), jmi.getActionCommand(), true); +}, "java.awt.event.MouseEvent"); +Clazz.defineMethod(c$, "mouseExited", +function(e){ +var jmi = e.getSource(); +this.popup.menuFocusCallback(jmi.getName(), jmi.getActionCommand(), false); +}, "java.awt.event.MouseEvent"); +Clazz.overrideMethod(c$, "dispose", +function(popupMenu){ +this.menuClearListeners(popupMenu); +this.popup = null; +}, "J.api.SC"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JsG2D.js b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JsG2D.js new file mode 100755 index 000000000000..386a35c4012d --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/JsG2D.js @@ -0,0 +1,180 @@ +Clazz.declarePackage("J.awtjs2d"); +Clazz.load(["J.api.GenericGraphics"], "J.awtjs2d.JsG2D", ["JU.CU", "JS.Color", "J.awtjs2d.Platform"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.windowWidth = 0; +this.windowHeight = 0; +this.isShifted = false; +this.inPath = false; +Clazz.instantialize(this, arguments);}, J.awtjs2d, "JsG2D", null, J.api.GenericGraphics); +/*LV!1824 unnec constructor*/Clazz.overrideMethod(c$, "getColor4", +function(r, g, b, a){ +return JS.Color.get4(r, g, b, a); +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "getColor3", +function(r, g, b){ +return JS.Color.get3(r, g, b); +}, "~N,~N,~N"); +Clazz.overrideMethod(c$, "getColor1", +function(rgb){ +return JS.Color.get1(rgb); +}, "~N"); +Clazz.overrideMethod(c$, "newGrayScaleImage", +function(context, image, width, height, grayBuffer){ +return J.awtjs2d.Platform.Jmol().newGrayScaleImage(context, image, width, height, grayBuffer); +}, "~O,~O,~N,~N,~A"); +Clazz.overrideMethod(c$, "drawGrayScaleImage", +function(g, image, destX0, destY0, destX1, destY1, srcX0, srcY0, srcX1, srcY1){ +var iw; +var ih; +{ +iw = image.w; +ih = image.h; +}var dw = (destX1 - destX0 + 1); +var dh = (destY1 - destY0 + 1); +var sw = (srcX1 - srcX0 + 1); +var sh = (srcY1 - srcY0 + 1); +var x = -srcX0 * dw / sw; +var w = iw * dw / sw; +var y = -srcY0 * dh / sh; +var h = ih * dh / sh; +{ +image.width = w; +image.height = h; +var div = image.div; +var layer = image.layer; +layer.style.left = destX0 + "px"; +layer.style.top = destY0 + "px"; +layer.style.width = dw + "px"; +layer.style.height = dh+ "px"; +div.style.left= x + "px"; +div.style.top = y + "px"; +div.style.width = w + "px"; +div.style.height = h + "px"; +}}, "~O,~O,~N,~N,~N,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawLine", +function(g, x0, y0, x1, y1){ +var inPath = this.inPath; +{ +if (!inPath) g.beginPath(); +g.moveTo(x0, y0); +g.lineTo(x1, y1); +if (!inPath) g.stroke(); +}}, "~O,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawCircle", +function(g, x, y, diameter){ +{ +var r = diameter/2; +g.beginPath(); +g.arc(x + r, y + r, r, 0, 2 * Math.PI, false); +g.stroke(); +}}, "~O,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawPolygon", +function(g, ayPoints, axPoints, nPoints){ +this.doPoly(g, ayPoints, axPoints, nPoints, false); +}, "~O,~A,~A,~N"); +Clazz.defineMethod(c$, "doPoly", +function(g, axPoints, ayPoints, nPoints, doFill){ +{ +g.beginPath(); +g.moveTo(axPoints[0], ayPoints[0]); +for (var i = 1; i < nPoints; i++) +g.lineTo(axPoints[i], ayPoints[i]); +if (doFill) +g.fill(); +else +g.stroke(); +}}, "~O,~A,~A,~N,~B"); +Clazz.overrideMethod(c$, "drawRect", +function(g, x, y, width, height){ +{ +g.beginPath(); +g.rect(x ,y, width, height); +g.stroke(); +}}, "~O,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawString", +function(g, s, x, y){ +{ +g.fillText(s,x,y); +}}, "~O,~S,~N,~N"); +Clazz.overrideMethod(c$, "drawStringRotated", +function(g, s, x, y, angle){ +}, "~O,~S,~N,~N,~N"); +Clazz.overrideMethod(c$, "fillBackground", +function(g, bgcolor){ +if (bgcolor == null) { +{ +if (!this.isShifted) { +g.translate(-0.5, -0.5); +this.isShifted = true; +} +g.clearRect(0,0, this.windowWidth, this.windowHeight); +return; +}}this.setGraphicsColor(g, bgcolor); +this.fillRect(g, 0, 0, this.windowWidth, this.windowHeight); +}, "~O,javajs.api.GenericColor"); +Clazz.overrideMethod(c$, "fillCircle", +function(g, x, y, diameter){ +{ +var r = diameter/2; +g.beginPath(); +g.arc(x + r, y + r, r, 0, 2 * Math.PI, false); +g.fill(); +}}, "~O,~N,~N,~N"); +Clazz.overrideMethod(c$, "fillPolygon", +function(g, ayPoints, axPoints, nPoints){ +this.doPoly(g, ayPoints, axPoints, nPoints, true); +}, "~O,~A,~A,~N"); +Clazz.overrideMethod(c$, "fillRect", +function(g, x, y, width, height){ +{ +g.fillRect(x, y, width, height); +}}, "~O,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "setGraphicsColor", +function(g, c){ +var s = JU.CU.toCSSString(c); +{ +g.fillStyle = g.strokeStyle = s; +}}, "~O,javajs.api.GenericColor"); +Clazz.overrideMethod(c$, "setFont", +function(g, font){ +var s = font.getInfo(); +var pt = s.indexOf(" "); +s = s.substring(0, pt) + "px" + s.substring(pt); +{ +g.font = s; +}return font; +}, "~O,JU.Font"); +Clazz.overrideMethod(c$, "setStrokeBold", +function(g, tf){ +{ +g.lineWidth = (tf ? 2 : 1); +}}, "~O,~B"); +Clazz.overrideMethod(c$, "setWindowParameters", +function(width, height){ +this.windowWidth = width; +this.windowHeight = height; +}, "~N,~N"); +Clazz.overrideMethod(c$, "translateScale", +function(g, x, y, scale){ +}, "~O,~N,~N,~N"); +Clazz.overrideMethod(c$, "canDoLineTo", +function(){ +return true; +}); +Clazz.overrideMethod(c$, "doStroke", +function(g, isBegin){ +this.inPath = isBegin; +{ +if (isBegin) { +g.beginPath(); +} else { +g.stroke(); +} +}}, "~O,~B"); +Clazz.overrideMethod(c$, "lineTo", +function(g, x2, y2){ +{ +g.lineTo(x2, y2); +}}, "~O,~N,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/Mouse.js b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/Mouse.js new file mode 100755 index 000000000000..83cb4b26c36b --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/Mouse.js @@ -0,0 +1,290 @@ +Clazz.declarePackage("J.awtjs2d"); +Clazz.load(["J.api.GenericMouseInterface"], "J.awtjs2d.Mouse", ["JU.PT", "$.V3", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.vwr = null; +this.manager = null; +this.keyBuffer = ""; +this.isMouseDown = false; +this.wheeling = false; +this.modifiersDown = 0; +this.xWhenPressed = 0; +this.yWhenPressed = 0; +this.modifiersWhenPressed10 = 0; +Clazz.instantialize(this, arguments);}, J.awtjs2d, "Mouse", null, J.api.GenericMouseInterface); +Clazz.makeConstructor(c$, +function(privateKey, vwr, display){ +this.vwr = vwr; +this.manager = this.vwr.acm; +}, "~N,JV.Viewer,~O"); +Clazz.overrideMethod(c$, "clear", +function(){ +}); +Clazz.overrideMethod(c$, "dispose", +function(){ +}); +Clazz.overrideMethod(c$, "processEvent", +function(id, x, y, modifiers, time){ +if (id != 507) modifiers = J.awtjs2d.Mouse.applyLeftMouse(modifiers); +switch (id) { +case 507: +this.wheeled(time, x, modifiers); +break; +case 501: +this.xWhenPressed = x; +this.yWhenPressed = y; +this.modifiersWhenPressed10 = modifiers; +this.pressed(time, x, y, modifiers, false); +break; +case 506: +this.dragged(time, x, y); +break; +case 504: +this.entry(time, x, y, false); +break; +case 505: +this.entry(time, x, y, true); +break; +case 503: +this.moved(time, x, y, modifiers); +break; +case 502: +this.released(time, x, y, modifiers); +if (x == this.xWhenPressed && y == this.yWhenPressed && modifiers == this.modifiersWhenPressed10) { +this.clicked(time, x, y, modifiers, 1); +}break; +default: +return false; +} +return true; +}, "~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "processTwoPointGesture", +function(touches){ +if (touches[0].length < 2) return; +var t1 = touches[0]; +var t2 = touches[1]; +var t1first = t1[0]; +var t1last = t1[t2.length - 1]; +var x1first = t1first[0]; +var x1last = t1last[0]; +var dx1 = x1last - x1first; +var y1first = t1first[1]; +var y1last = t1last[1]; +var dy1 = y1last - y1first; +var v1 = JU.V3.new3(dx1, dy1, 0); +var d1 = v1.length(); +var t2first = t2[0]; +var t2last = t2[t2.length - 1]; +var x2first = t2first[0]; +var x2last = t2last[0]; +var dx2 = x2last - x2first; +var y2first = t2first[1]; +var y2last = t2last[1]; +var dy2 = y2last - y2first; +var v2 = JU.V3.new3(dx2, dy2, 0); +var d2 = v2.length(); +if (d1 < 1 || d2 < 1) return; +v1.normalize(); +v2.normalize(); +var cos12 = (v1.dot(v2)); +if (cos12 > 0.8) { +var deltaX = Clazz.floatToInt(x1last - t1[t1.length - 2][0]); +var deltaY = Clazz.floatToInt(y1last - t1[t1.length - 2][1]); +this.vwr.translateXYBy(deltaX, deltaY); +} else if (cos12 < -0.8) { +v1 = JU.V3.new3(x2first - x1first, y2first - y1first, 0); +v2 = JU.V3.new3(x2last - x1last, y2last - y1last, 0); +var dx = v2.length() - v1.length(); +this.wheeled(System.currentTimeMillis(), dx < 0 ? -1 : 1, 32); +}}, "~A"); +Clazz.defineMethod(c$, "mouseClicked", +function(e){ +this.clicked(e.getWhen(), e.getX(), e.getY(), e.getModifiers(), e.getClickCount()); +}, "java.awt.event.MouseEvent"); +Clazz.defineMethod(c$, "mouseEntered", +function(e){ +this.entry(e.getWhen(), e.getX(), e.getY(), false); +}, "java.awt.event.MouseEvent"); +Clazz.defineMethod(c$, "mouseExited", +function(e){ +this.entry(e.getWhen(), e.getX(), e.getY(), true); +}, "java.awt.event.MouseEvent"); +Clazz.defineMethod(c$, "mousePressed", +function(e){ +this.pressed(e.getWhen(), e.getX(), e.getY(), e.getModifiers(), e.isPopupTrigger()); +}, "java.awt.event.MouseEvent"); +Clazz.defineMethod(c$, "mouseReleased", +function(e){ +this.released(e.getWhen(), e.getX(), e.getY(), e.getModifiers()); +}, "java.awt.event.MouseEvent"); +Clazz.defineMethod(c$, "mouseDragged", +function(e){ +var modifiers = e.getModifiers(); +if ((modifiers & 28) == 0) modifiers |= 16; +this.dragged(e.getWhen(), e.getX(), e.getY()); +}, "java.awt.event.MouseEvent"); +Clazz.defineMethod(c$, "mouseMoved", +function(e){ +this.moved(e.getWhen(), e.getX(), e.getY(), e.getModifiers()); +}, "java.awt.event.MouseEvent"); +Clazz.defineMethod(c$, "mouseWheelMoved", +function(e){ +e.consume(); +this.wheeled(e.getWhen(), e.getWheelRotation(), e.getModifiers()); +}, "java.awt.event.MouseWheelEvent"); +Clazz.defineMethod(c$, "keyTyped", +function(ke){ +ke.consume(); +if (!this.vwr.menuEnabled()) return; +var ch = ke.getKeyChar(); +var modifiers = ke.getModifiers(); +if (JU.Logger.debuggingHigh) JU.Logger.debug("MouseManager keyTyped: " + ch + " " + (0 + ch.charCodeAt(0)) + " " + modifiers); +if (modifiers != 0 && modifiers != 1) { +switch ((ch).charCodeAt(0)) { +case String.fromCharCode(11): +case 107: +var isON = !this.vwr.getBooleanProperty("allowKeyStrokes"); +switch (modifiers) { +case 2: +this.vwr.setBooleanProperty("allowKeyStrokes", isON); +this.vwr.setBooleanProperty("showKeyStrokes", true); +break; +case 10: +case 1: +this.vwr.setBooleanProperty("allowKeyStrokes", isON); +this.vwr.setBooleanProperty("showKeyStrokes", false); +break; +} +this.clearKeyBuffer(); +this.vwr.refresh(3, "showkey"); +break; +case 22: +case 118: +switch (modifiers) { +case 2: +break; +} +break; +case 26: +case 122: +switch (modifiers) { +case 2: +this.vwr.undoMoveAction(4165, 1); +break; +case 3: +this.vwr.undoMoveAction(4140, 1); +break; +} +break; +case 25: +case 121: +switch (modifiers) { +case 2: +this.vwr.undoMoveAction(4140, 1); +break; +} +break; +} +return; +}if (!this.vwr.getBooleanProperty("allowKeyStrokes")) return; +this.addKeyBuffer(ke.getModifiers() == 1 ? Character.toUpperCase(ch) : ch); +}, "java.awt.event.KeyEvent"); +Clazz.defineMethod(c$, "keyPressed", +function(ke){ +if (this.vwr.isApplet) ke.consume(); +this.manager.keyPressed(ke.getKeyCode(), ke.getModifiers()); +}, "java.awt.event.KeyEvent"); +Clazz.defineMethod(c$, "keyReleased", +function(ke){ +ke.consume(); +this.manager.keyReleased(ke.getKeyCode()); +}, "java.awt.event.KeyEvent"); +Clazz.defineMethod(c$, "clearKeyBuffer", +function(){ +if (this.keyBuffer.length == 0) return; +this.keyBuffer = ""; +if (this.vwr.getBooleanProperty("showKeyStrokes")) this.vwr.evalStringQuietSync("!set echo _KEYSTROKES; set echo bottom left;echo \"\"", true, true); +}); +Clazz.defineMethod(c$, "addKeyBuffer", +function(ch){ +if (ch.charCodeAt(0) == 10) { +this.sendKeyBuffer(); +return; +}if (ch.charCodeAt(0) == 8) { +if (this.keyBuffer.length > 0) this.keyBuffer = this.keyBuffer.substring(0, this.keyBuffer.length - 1); +} else { +this.keyBuffer += ch; +}if (this.vwr.getBooleanProperty("showKeyStrokes")) this.vwr.evalStringQuietSync("!set echo _KEYSTROKES; set echo bottom left;echo " + JU.PT.esc("\1" + this.keyBuffer), true, true); +}, "~S"); +Clazz.defineMethod(c$, "sendKeyBuffer", +function(){ +var kb = this.keyBuffer; +if (this.vwr.getBooleanProperty("showKeyStrokes")) this.vwr.evalStringQuietSync("!set echo _KEYSTROKES; set echo bottom left;echo " + JU.PT.esc(this.keyBuffer), true, true); +this.clearKeyBuffer(); +this.vwr.evalStringQuietSync(kb, false, true); +}); +Clazz.defineMethod(c$, "entry", +function(time, x, y, isExit){ +this.wheeling = false; +this.isMouseDown = false; +this.modifiersDown = 0; +this.manager.mouseEnterExit(time, x, y, isExit); +}, "~N,~N,~N,~B"); +Clazz.defineMethod(c$, "clicked", +function(time, x, y, modifiers, clickCount){ +this.clearKeyBuffer(); +this.manager.mouseAction(2, time, x, y, 1, modifiers); +}, "~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "moved", +function(time, x, y, modifiers){ +this.clearKeyBuffer(); +if (this.isMouseDown) this.manager.mouseAction(1, time, x, y, 0, this.modifiersDown); + else this.manager.mouseAction(0, time, x, y, 0, modifiers); +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "wheeled", +function(time, rotation, modifiers){ +this.clearKeyBuffer(); +this.wheeling = true; +this.manager.mouseAction(3, time, 0, rotation, 0, modifiers & -29 | 32); +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "pressed", +function(time, x, y, modifiers, isPopupTrigger){ +this.clearKeyBuffer(); +this.isMouseDown = true; +this.modifiersDown = modifiers; +this.wheeling = false; +this.manager.mouseAction(4, time, x, y, 0, modifiers); +}, "~N,~N,~N,~N,~B"); +Clazz.defineMethod(c$, "released", +function(time, x, y, modifiers){ +this.isMouseDown = false; +this.modifiersDown = 0; +this.wheeling = false; +this.manager.mouseAction(5, time, x, y, 0, modifiers); +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "dragged", +function(time, x, y){ +if (this.wheeling) return; +if ((this.modifiersDown & 20) == 20) this.modifiersDown = this.modifiersDown & -5 | 2; +this.manager.mouseAction(1, time, x, y, 0, this.modifiersDown); +}, "~N,~N,~N"); +c$.applyLeftMouse = Clazz.defineMethod(c$, "applyLeftMouse", +function(modifiers){ +return ((modifiers & 28) == 0) ? (modifiers | 16) : modifiers; +}, "~N"); +Clazz.overrideMethod(c$, "processKeyEvent", +function(event){ +var e = event; +switch (e.getID()) { +case 401: +this.keyPressed(e); +break; +case 402: +this.keyReleased(e); +break; +case 400: +this.keyTyped(e); +break; +} +}, "~O"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/Platform.js b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/Platform.js new file mode 100755 index 000000000000..9a4991dab4d3 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/awtjs2d/Platform.js @@ -0,0 +1,288 @@ +Clazz.declarePackage("J.awtjs2d"); +Clazz.load(["J.api.GenericPlatform"], "J.awtjs2d.Platform", ["java.net.URL", "JU.AjaxURLStreamHandlerFactory", "$.Rdr", "J.api.Interface", "J.awtjs2d.Display", "$.Image", "$.JSFile", "$.JSFont", "$.Mouse"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.canvas = null; +this.vwr = null; +this.context = null; +Clazz.instantialize(this, arguments);}, J.awtjs2d, "Platform", null, J.api.GenericPlatform); +Clazz.overrideMethod(c$, "setViewer", +function(vwr, canvas){ +{ +this.vwr = vwr; +if (canvas == null) { +canvas = document.createElement('canvas'); +this.context = canvas.getContext("2d"); +} else { +this.context = canvas.getContext("2d"); +canvas.imgdata = this.context.getImageData(0, 0, canvas.width, canvas.height); +canvas.buf8 = canvas.imgdata.data; +} +}this.canvas = canvas; +try { +java.net.URL.setURLStreamHandlerFactory( new JU.AjaxURLStreamHandlerFactory()); +} catch (e) { +} +}, "J.api.PlatformViewer,~O"); +Clazz.overrideMethod(c$, "isSingleThreaded", +function(){ +return true; +}); +Clazz.overrideMethod(c$, "getJsObjectInfo", +function(jsObject, method, args){ +{ +return (method == null ? null : method == "localName" ? jsObject[0]["nodeName"] : args == null ? jsObject[0][method] : jsObject[0][method](args[0])); +}}, "~A,~S,~A"); +Clazz.overrideMethod(c$, "isHeadless", +function(){ +return false; +}); +Clazz.overrideMethod(c$, "getMouseManager", +function(privateKey, display){ +return new J.awtjs2d.Mouse(privateKey, this.vwr, display); +}, "~N,~O"); +Clazz.overrideMethod(c$, "convertPointFromScreen", +function(canvas, ptTemp){ +J.awtjs2d.Display.convertPointFromScreen(canvas, ptTemp); +}, "~O,JU.P3"); +Clazz.overrideMethod(c$, "getFullScreenDimensions", +function(canvas, widthHeight){ +J.awtjs2d.Display.getFullScreenDimensions(canvas, widthHeight); +}, "~O,~A"); +Clazz.overrideMethod(c$, "getMenuPopup", +function(menuStructure, type){ +var c = (type == 'j' ? "awtjs2d.JSJmolPopup" : "awtjs2d.JSModelKitPopup"); +var jmolpopup = J.api.Interface.getOption(c, this.vwr, "popup"); +try { +if (jmolpopup != null) jmolpopup.jpiInitialize(this.vwr, menuStructure); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +c = "Exception creating " + c + ":" + e; +System.out.println(c); +return null; +} else { +throw e; +} +} +return jmolpopup; +}, "~S,~S"); +Clazz.overrideMethod(c$, "hasFocus", +function(canvas){ +return J.awtjs2d.Display.hasFocus(canvas); +}, "~O"); +Clazz.overrideMethod(c$, "prompt", +function(label, data, list, asButtons){ +return J.awtjs2d.Display.prompt(label, data, list, asButtons); +}, "~S,~S,~A,~B"); +Clazz.overrideMethod(c$, "renderScreenImage", +function(context, size){ +J.awtjs2d.Display.renderScreenImage(this.vwr, context, size); +}, "~O,~O"); +Clazz.overrideMethod(c$, "drawImage", +function(context, canvas, x, y, width, height, isDTI){ +J.awtjs2d.Display.drawImage(context, canvas, x, y, width, height, isDTI); +}, "~O,~O,~N,~N,~N,~N,~B"); +Clazz.overrideMethod(c$, "requestFocusInWindow", +function(canvas){ +J.awtjs2d.Display.requestFocusInWindow(canvas); +}, "~O"); +Clazz.overrideMethod(c$, "repaint", +function(canvas){ +var jmol = null; +{ +jmol = (self.Jmol && Jmol.repaint ? Jmol : null); +}if (jmol != null) jmol.repaint((this.vwr).html5Applet, true); +}, "~O"); +Clazz.overrideMethod(c$, "setTransparentCursor", +function(canvas){ +}, "~O"); +Clazz.overrideMethod(c$, "setCursor", +function(c, canvas){ +J.awtjs2d.Platform.Jmol().setCursor((this.vwr).html5Applet, c); +}, "~N,~O"); +Clazz.overrideMethod(c$, "allocateRgbImage", +function(windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent, isImageWrite){ +if (pBuffer == null) { +pBuffer = this.grabPixels(null, 0, 0, null); +{ +windowWidth = this.canvas.width; +windowHeight = this.canvas.height; +}}return J.awtjs2d.Image.allocateRgbImage(windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent, (isImageWrite ? null : this.canvas)); +}, "~N,~N,~A,~N,~B,~B"); +Clazz.overrideMethod(c$, "notifyEndOfRendering", +function(){ +}); +Clazz.overrideMethod(c$, "disposeGraphics", +function(gOffscreen){ +}, "~O"); +Clazz.overrideMethod(c$, "grabPixels", +function(canvas, width, height, pixels){ +var context2d = null; +var isWebGL = (canvas == null); +{ +if(isWebGL) { this.canvas = canvas = +Jmol.loadImage(this,"webgl","" ++System.currentTimeMillis(),this +.vwr.html5Applet._canvas.toDataURL(),null,null); width = +canvas.imageWidth; height = canvas.imageHeight; +canvas.imageWidth = 0; } +if (canvas.image && (width != canvas.width || height != +canvas.height)) Jmol.setCanvasImage(canvas, width, height); +if (canvas.buf32) return canvas.buf32; context2d = +canvas.getContext('2d'); +}var buf = J.awtjs2d.Image.grabPixels(context2d, width, height); +{ +canvas.buf32 = buf; +}if (isWebGL) for (var i = buf.length; --i >= 0; ) if (buf[i] == 0) buf[i] = -1; + +return buf; +}, "~O,~N,~N,~A"); +Clazz.overrideMethod(c$, "drawImageToBuffer", +function(gOffscreen, imageOffscreen, canvas, width, height, bgcolor){ +return this.grabPixels(canvas, width, height, null); +}, "~O,~O,~O,~N,~N,~N"); +Clazz.overrideMethod(c$, "getTextPixels", +function(text, font3d, context, image, width, height, ascent){ +return J.awtjs2d.Image.getTextPixels(text, font3d, context, width, height, ascent); +}, "~S,JU.Font,~O,~O,~N,~N,~N"); +Clazz.overrideMethod(c$, "flushImage", +function(imagePixelBuffer){ +}, "~O"); +Clazz.overrideMethod(c$, "getGraphics", +function(canvas){ +{ +return (canvas == null ? this.context : canvas.getContext("2d")); +}}, "~O"); +Clazz.overrideMethod(c$, "getImageHeight", +function(canvas){ +return (canvas == null ? -1 : J.awtjs2d.Image.getHeight(canvas)); +}, "~O"); +Clazz.overrideMethod(c$, "getImageWidth", +function(canvas){ +return (canvas == null ? -1 : J.awtjs2d.Image.getWidth(canvas)); +}, "~O"); +Clazz.overrideMethod(c$, "getStaticGraphics", +function(image, backgroundTransparent){ +return this.getGraphics(image); +}, "~O,~B"); +Clazz.overrideMethod(c$, "newBufferedImage", +function(image, w, h){ +return J.awtjs2d.Platform.Jmol().getHiddenCanvas((this.vwr).html5Applet, "stereoImage", w, h); +}, "~O,~N,~N"); +Clazz.overrideMethod(c$, "newOffScreenImage", +function(w, h){ +return J.awtjs2d.Platform.Jmol().getHiddenCanvas((this.vwr).html5Applet, "textImage", w, h); +}, "~N,~N"); +Clazz.overrideMethod(c$, "waitForDisplay", +function(echoNameAndPath, zipBytes){ +return false; +}, "~O,~O"); +Clazz.overrideMethod(c$, "createImage", +function(name_path_bytes){ +var echoName = (name_path_bytes)[0]; +var path = (name_path_bytes)[1]; +var bytes = (name_path_bytes)[2]; +var vwr = this.vwr; +var sc = (bytes == null ? vwr.getEvalContextAndHoldQueue(vwr.eval) : null); +var f = null; +{ +f = function(canvas, pathOrError) { vwr.loadImageData(canvas, pathOrError, echoName, sc) }; +}return J.awtjs2d.Platform.Jmol().loadImage(this, echoName, path, bytes, f); +}, "~O"); +Clazz.overrideMethod(c$, "fontStringWidth", +function(font, text){ +return J.awtjs2d.JSFont.stringWidth(font, this.context, text); +}, "JU.Font,~S"); +Clazz.overrideMethod(c$, "getFontAscent", +function(context){ +return J.awtjs2d.JSFont.getAscent(context); +}, "~O"); +Clazz.overrideMethod(c$, "getFontDescent", +function(context){ +return J.awtjs2d.JSFont.getDescent(context); +}, "~O"); +Clazz.overrideMethod(c$, "getFontMetrics", +function(font, context){ +return J.awtjs2d.JSFont.getFontMetrics(font, context == null ? this.context : context); +}, "JU.Font,~O"); +Clazz.overrideMethod(c$, "newFont", +function(fontFace, isBold, isItalic, fontSize){ +return J.awtjs2d.JSFont.newFont(fontFace, isBold, isItalic, fontSize, "px"); +}, "~S,~B,~B,~N"); +Clazz.overrideMethod(c$, "getDateFormat", +function(isoType){ +{ +if (isoType == null) { +} else if (isoType.indexOf("8824") >= 0) { +var d = new Date(); +var x = d.toString().split(" "); +var MM = "0" + (1 + d.getMonth()); MM = MM.substring(MM.length - 2); +var dd = "0" + d.getDate(); dd = dd.substring(dd.length - 2); +return x[3] + MM + dd + x[4].replace(/\:/g,"") + x[5].substring(3,6) + "'" + x[5].substring(6,8) + "'" +} else if (isoType.indexOf("8601") >= 0){ +var d = new Date(); +var x = d.toString().split(" "); +// Firefox now doing this? +if (x.length == 1) +return x; +var MM = "0" + (1 + d.getMonth()); MM = MM.substring(MM.length - 2); +var dd = "0" + d.getDate(); dd = dd.substring(dd.length - 2); +return x[3] + '-' + MM + '-' + dd + 'T' + x[4] +} +return ("" + (new Date())).split(" (")[0]; +}}, "~S"); +Clazz.overrideMethod(c$, "newFile", +function(name){ +return new J.awtjs2d.JSFile(name); +}, "~S"); +Clazz.overrideMethod(c$, "getBufferedFileInputStream", +function(name){ +return null; +}, "~S"); +Clazz.overrideMethod(c$, "getURLContents", +function(url, outputBytes, post, asString){ +return J.awtjs2d.Platform.getURLContentsStatic(url, outputBytes, post, asString); +}, "java.net.URL,~A,~S,~B"); +c$.getURLContentsStatic = Clazz.defineMethod(c$, "getURLContentsStatic", +function(url, outputBytes, post, asString){ +var ret = J.awtjs2d.JSFile.getURLContents(url, outputBytes, post); +try { +return (!asString ? ret : (typeof(ret)=='string') ? ret : Clazz.instanceOf(ret,"JU.SB") ? (ret).toString() : Clazz.instanceOf(ret,Array) ? String.instantialize(ret) : String.instantialize(JU.Rdr.getStreamAsBytes(ret, null))); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +return "" + e; +} else { +throw e; +} +} +}, "java.net.URL,~A,~S,~B"); +Clazz.overrideMethod(c$, "getLocalUrl", +function(fileName){ +return null; +}, "~S"); +Clazz.overrideMethod(c$, "getImageDialog", +function(title, imageMap){ +return J.awtjs2d.Image.getImageDialog(this.vwr, title, imageMap); +}, "~S,java.util.Map"); +c$.Jmol = Clazz.defineMethod(c$, "Jmol", +function(){ +{ +return Jmol; +}}); +Clazz.overrideMethod(c$, "forceAsyncLoad", +function(filename){ +return J.awtjs2d.Platform.Jmol().isBinaryUrl(filename); +}, "~S"); +Clazz.overrideMethod(c$, "getInChI", +function(){ +return (J.awtjs2d.Platform.inchi == null ? (J.awtjs2d.Platform.inchi = J.api.Interface.getInterface("J.inchi.InChIJS", this.vwr, "platform")) : J.awtjs2d.Platform.inchi); +}); +Clazz.overrideMethod(c$, "confirm", +function(msg, msgNo){ +var ok = false; +if (ok) return 0; +if (msgNo != null) ok = false; +return (ok ? 1 : 2); +}, "~S,~S"); +c$.inchi = null; +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/bspt/Bspf.js b/config/plugins/visualizations/jmol/static/j2s/J/bspt/Bspf.js new file mode 100755 index 000000000000..fe4ec1518e7e --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/bspt/Bspf.js @@ -0,0 +1,60 @@ +Clazz.declarePackage("J.bspt"); +Clazz.load(null, "J.bspt.Bspf", ["JU.AU", "J.bspt.Bspt"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.dimMax = 0; +this.bspts = null; +this.isValid = false; +this.bsptsValid = null; +this.cubeIterators = null; +Clazz.instantialize(this, arguments);}, J.bspt, "Bspf", null); +Clazz.makeConstructor(c$, +function(dimMax){ +this.dimMax = dimMax; +this.bspts = new Array(1); +this.bsptsValid = Clazz.newBooleanArray(1, false); +this.cubeIterators = new Array(0); +}, "~N"); +Clazz.defineMethod(c$, "validateModel", +function(i, isValid){ +this.bsptsValid[i] = isValid; +}, "~N,~B"); +Clazz.defineMethod(c$, "isInitializedIndex", +function(bsptIndex){ +return this.bspts.length > bsptIndex && this.bspts[bsptIndex] != null && this.bsptsValid[bsptIndex]; +}, "~N"); +Clazz.defineMethod(c$, "addTuple", +function(bsptIndex, tuple){ +if (bsptIndex >= this.bspts.length) { +this.bspts = JU.AU.arrayCopyObject(this.bspts, bsptIndex + 1); +this.bsptsValid = JU.AU.arrayCopyBool(this.bsptsValid, bsptIndex + 1); +}var bspt = this.bspts[bsptIndex]; +if (bspt == null) { +bspt = this.bspts[bsptIndex] = new J.bspt.Bspt(this.dimMax, bsptIndex); +}bspt.addTuple(tuple); +}, "~N,JU.P3"); +Clazz.defineMethod(c$, "stats", +function(){ +for (var i = 0; i < this.bspts.length; ++i) if (this.bspts[i] != null) this.bspts[i].stats(); + +}); +Clazz.defineMethod(c$, "getCubeIterator", +function(bsptIndex){ +if (bsptIndex < 0) return this.getNewCubeIterator(-1 - bsptIndex); +if (bsptIndex >= this.cubeIterators.length) this.cubeIterators = JU.AU.arrayCopyObject(this.cubeIterators, bsptIndex + 1); +if (this.cubeIterators[bsptIndex] == null && this.bspts[bsptIndex] != null) this.cubeIterators[bsptIndex] = this.getNewCubeIterator(bsptIndex); +this.cubeIterators[bsptIndex].set(this.bspts[bsptIndex]); +return this.cubeIterators[bsptIndex]; +}, "~N"); +Clazz.defineMethod(c$, "getNewCubeIterator", +function(bsptIndex){ +return this.bspts[bsptIndex].allocateCubeIterator(); +}, "~N"); +Clazz.defineMethod(c$, "initialize", +function(modelIndex, atoms, modelAtomBitSet){ +if (this.bspts[modelIndex] != null) this.bspts[modelIndex].reset(); +for (var i = modelAtomBitSet.nextSetBit(0); i >= 0; i = modelAtomBitSet.nextSetBit(i + 1)) this.addTuple(modelIndex, atoms[i]); + +this.bsptsValid[modelIndex] = true; +}, "~N,~A,JU.BS"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/bspt/Bspt.js b/config/plugins/visualizations/jmol/static/j2s/J/bspt/Bspt.js new file mode 100755 index 000000000000..f5f7d30e074e --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/bspt/Bspt.js @@ -0,0 +1,32 @@ +Clazz.declarePackage("J.bspt"); +Clazz.load(null, "J.bspt.Bspt", ["J.bspt.CubeIterator", "$.Leaf"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.treeDepth = 0; +this.dimMax = 0; +this.index = 0; +this.eleRoot = null; +Clazz.instantialize(this, arguments);}, J.bspt, "Bspt", null); +Clazz.makeConstructor(c$, +function(dimMax, index){ +this.dimMax = dimMax; +this.index = index; +this.reset(); +}, "~N,~N"); +Clazz.defineMethod(c$, "reset", +function(){ +this.eleRoot = new J.bspt.Leaf(this, null, 0); +this.treeDepth = 1; +}); +Clazz.defineMethod(c$, "addTuple", +function(tuple){ +this.eleRoot = this.eleRoot.addTuple(0, tuple); +}, "JU.T3"); +Clazz.defineMethod(c$, "stats", +function(){ +}); +Clazz.defineMethod(c$, "allocateCubeIterator", +function(){ +return new J.bspt.CubeIterator(this); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/bspt/CubeIterator.js b/config/plugins/visualizations/jmol/static/j2s/J/bspt/CubeIterator.js new file mode 100755 index 000000000000..182122379d98 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/bspt/CubeIterator.js @@ -0,0 +1,103 @@ +Clazz.declarePackage("J.bspt"); +(function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.bspt = null; +this.stack = null; +this.sp = 0; +this.leafIndex = 0; +this.leaf = null; +this.radius = 0; +this.cx = 0; +this.cy = 0; +this.cz = 0; +this.dx = 0; +this.dy = 0; +this.dz = 0; +this.tHemisphere = false; +Clazz.instantialize(this, arguments);}, J.bspt, "CubeIterator", null); +Clazz.makeConstructor(c$, +function(bspt){ +this.set(bspt); +}, "J.bspt.Bspt"); +Clazz.defineMethod(c$, "set", +function(bspt){ +this.bspt = bspt; +this.stack = new Array(bspt.treeDepth); +}, "J.bspt.Bspt"); +Clazz.defineMethod(c$, "initialize", +function(center, radius, hemisphereOnly){ +this.radius = radius; +this.tHemisphere = false; +this.cx = center.x; +this.cy = center.y; +this.cz = center.z; +this.leaf = null; +if (this.stack.length < this.bspt.treeDepth) this.set(this.bspt); +this.stack[0] = this.bspt.eleRoot; +this.sp = 1; +this.findLeftLeaf(); +this.tHemisphere = hemisphereOnly; +}, "JU.T3,~N,~B"); +Clazz.defineMethod(c$, "release", +function(){ +this.set(this.bspt); +}); +Clazz.defineMethod(c$, "hasMoreElements", +function(){ +while (this.leaf != null) { +for (; this.leafIndex < this.leaf.count; ++this.leafIndex) if (this.isWithinRadius(this.leaf.tuples[this.leafIndex])) return true; + +this.findLeftLeaf(); +} +return false; +}); +Clazz.defineMethod(c$, "nextElement", +function(){ +return this.leaf.tuples[this.leafIndex++]; +}); +Clazz.defineMethod(c$, "foundDistance2", +function(){ +return this.dx * this.dx + this.dy * this.dy + this.dz * this.dz; +}); +Clazz.defineMethod(c$, "findLeftLeaf", +function(){ +this.leaf = null; +if (this.sp == 0) return; +var ele = this.stack[--this.sp]; +while (Clazz.instanceOf(ele,"J.bspt.Node")) { +var node = ele; +var minValue; +switch (node.dim) { +case 0: +minValue = this.cx; +break; +case 1: +minValue = this.cy; +break; +case 2: +default: +minValue = this.cz; +break; +} +var maxValue = minValue + this.radius; +if (!this.tHemisphere || node.dim != 0) minValue -= this.radius; +if (minValue <= node.maxLeft && maxValue >= node.minLeft) { +if (maxValue >= node.minRight && minValue <= node.maxRight) { +this.stack[this.sp++] = node.eleRight; +}ele = node.eleLeft; +} else if (maxValue >= node.minRight && minValue <= node.maxRight) { +ele = node.eleRight; +} else { +if (this.sp == 0) return; +ele = this.stack[--this.sp]; +}} +this.leaf = ele; +this.leafIndex = 0; +}); +Clazz.defineMethod(c$, "isWithinRadius", +function(t){ +this.dx = t.x - this.cx; +return ((!this.tHemisphere || this.dx >= 0) && (this.dx = Math.abs(this.dx)) <= this.radius && (this.dy = Math.abs(t.y - this.cy)) <= this.radius && (this.dz = Math.abs(t.z - this.cz)) <= this.radius); +}, "JU.T3"); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/bspt/Element.js b/config/plugins/visualizations/jmol/static/j2s/J/bspt/Element.js new file mode 100755 index 000000000000..a8df7f79b59d --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/bspt/Element.js @@ -0,0 +1,8 @@ +Clazz.declarePackage("J.bspt"); +(function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.bspt = null; +this.count = 0; +Clazz.instantialize(this, arguments);}, J.bspt, "Element", null); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/bspt/Leaf.js b/config/plugins/visualizations/jmol/static/j2s/J/bspt/Leaf.js new file mode 100755 index 000000000000..7fe1ed436301 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/bspt/Leaf.js @@ -0,0 +1,43 @@ +Clazz.declarePackage("J.bspt"); +Clazz.load(["J.bspt.Element"], "J.bspt.Leaf", ["J.bspt.Node"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.tuples = null; +Clazz.instantialize(this, arguments);}, J.bspt, "Leaf", J.bspt.Element); +Clazz.makeConstructor(c$, +function(bspt, leaf, countToKeep){ +this.bspt = bspt; +this.count = 0; +this.tuples = new Array(2); +if (leaf == null) return; +for (var i = countToKeep; i < 2; ++i) { +this.tuples[this.count++] = leaf.tuples[i]; +leaf.tuples[i] = null; +} +leaf.count = countToKeep; +}, "J.bspt.Bspt,J.bspt.Leaf,~N"); +Clazz.defineMethod(c$, "sort", +function(dim){ +for (var i = this.count; --i > 0; ) { +var champion = this.tuples[i]; +var championValue = J.bspt.Node.getDimensionValue(champion, dim); +for (var j = i; --j >= 0; ) { +var challenger = this.tuples[j]; +var challengerValue = J.bspt.Node.getDimensionValue(challenger, dim); +if (challengerValue > championValue) { +this.tuples[i] = challenger; +this.tuples[j] = champion; +champion = challenger; +championValue = challengerValue; +}} +} +}, "~N"); +Clazz.overrideMethod(c$, "addTuple", +function(level, tuple){ +if (this.count < 2) { +this.tuples[this.count++] = tuple; +return this; +}var node = new J.bspt.Node(this.bspt, level, this); +return node.addTuple(level, tuple); +}, "~N,JU.T3"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/bspt/Node.js b/config/plugins/visualizations/jmol/static/j2s/J/bspt/Node.js new file mode 100755 index 000000000000..5ffb3da63efe --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/bspt/Node.js @@ -0,0 +1,72 @@ +Clazz.declarePackage("J.bspt"); +Clazz.load(["J.bspt.Element"], "J.bspt.Node", ["J.bspt.Leaf"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.dim = 0; +this.minLeft = 0; +this.maxLeft = 0; +this.eleLeft = null; +this.minRight = 0; +this.maxRight = 0; +this.eleRight = null; +Clazz.instantialize(this, arguments);}, J.bspt, "Node", J.bspt.Element); +Clazz.makeConstructor(c$, +function(bspt, level, leafLeft){ +this.bspt = bspt; +if (level == bspt.treeDepth) { +bspt.treeDepth = level + 1; +}if (leafLeft.count != 2) throw new NullPointerException(); +this.dim = level % bspt.dimMax; +leafLeft.sort(this.dim); +var leafRight = new J.bspt.Leaf(bspt, leafLeft, 1); +this.minLeft = J.bspt.Node.getDimensionValue(leafLeft.tuples[0], this.dim); +this.maxLeft = J.bspt.Node.getDimensionValue(leafLeft.tuples[leafLeft.count - 1], this.dim); +this.minRight = J.bspt.Node.getDimensionValue(leafRight.tuples[0], this.dim); +this.maxRight = J.bspt.Node.getDimensionValue(leafRight.tuples[leafRight.count - 1], this.dim); +this.eleLeft = leafLeft; +this.eleRight = leafRight; +this.count = 2; +}, "J.bspt.Bspt,~N,J.bspt.Leaf"); +Clazz.defineMethod(c$, "addTuple", +function(level, tuple){ +var dimValue = J.bspt.Node.getDimensionValue(tuple, this.dim); +++this.count; +var addLeft; +if (dimValue < this.maxLeft) { +addLeft = true; +} else if (dimValue > this.minRight) { +addLeft = false; +} else if (dimValue == this.maxLeft) { +if (dimValue == this.minRight) { +if (this.eleLeft.count < this.eleRight.count) addLeft = true; + else addLeft = false; +} else { +addLeft = true; +}} else if (dimValue == this.minRight) { +addLeft = false; +} else { +if (this.eleLeft.count < this.eleRight.count) addLeft = true; + else addLeft = false; +}if (addLeft) { +if (dimValue < this.minLeft) this.minLeft = dimValue; + else if (dimValue > this.maxLeft) this.maxLeft = dimValue; +this.eleLeft = this.eleLeft.addTuple(level + 1, tuple); +} else { +if (dimValue < this.minRight) this.minRight = dimValue; + else if (dimValue > this.maxRight) this.maxRight = dimValue; +this.eleRight = this.eleRight.addTuple(level + 1, tuple); +}return this; +}, "~N,JU.T3"); +c$.getDimensionValue = Clazz.defineMethod(c$, "getDimensionValue", +function(pt, dim){ +if (pt == null) System.out.println("bspt.Node ???"); +switch (dim) { +case 0: +return pt.x; +case 1: +return pt.y; +default: +return pt.z; +} +}, "JU.T3,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/bspt/PointIterator.js b/config/plugins/visualizations/jmol/static/j2s/J/bspt/PointIterator.js new file mode 100755 index 000000000000..89df94da09fe --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/bspt/PointIterator.js @@ -0,0 +1,96 @@ +Clazz.declarePackage("J.bspt"); +Clazz.load(null, "J.bspt.PointIterator", ["JU.BS", "$.Lst", "$.P3", "J.bspt.Bspt", "JU.BSUtil", "$.Point3fi"], function(){ +var c$ = Clazz.declareType(J.bspt, "PointIterator", null); +c$.withinDistPoints = Clazz.defineMethod(c$, "withinDistPoints", +function(distance, pt, ap3, ap31, bsSelected, ret){ +var pts = new JU.Lst(); +var bspt = new J.bspt.Bspt(3, 0); +var iter; +if (pt != null && Float.isNaN(pt.x)) { +var pt3 = new Array(ap3.length); +var p; +for (var i = pt3.length; --i >= 0; ) { +var p3 = ap3[i]; +if (p3 == null) return 0; +if (bsSelected == null) { +p = new JU.Point3fi(); +p.setT(p3); +p.i = i; +pt3[i] = p; +bspt.addTuple(p); +} else { +bspt.addTuple(p3); +}} +iter = bspt.allocateCubeIterator(); +var bsp; +if (bsSelected != null) { +bsp = JU.BS.newN(ap31.length); +for (var i = bsSelected.nextSetBit(0); i >= 0; i = bsSelected.nextSetBit(i + 1)) { +iter.initialize(ap31[i], distance, false); +var d2 = distance * distance; +while (iter.hasMoreElements()) { +if (iter.nextElement().distanceSquared(ap31[i]) <= d2) { +bsp.set(i); +break; +}} +} +ret[0] = bsp; +return 10; +}bsp = JU.BSUtil.newBitSet2(0, ap3.length); +for (var i = pt3.length; --i >= 0; ) { +iter.initialize(p = pt3[i], distance, false); +var d2 = distance * distance; +var n = 0; +while (iter.hasMoreElements()) { +var pt2 = iter.nextElement(); +if (bsp.get(pt2.i) && pt2.distanceSquared(p) <= d2 && (++n > 1)) bsp.clear(pt2.i); +} +} +for (var i = bsp.nextSetBit(0); i >= 0; i = bsp.nextSetBit(i + 1)) pts.addLast(JU.P3.newP(pt3[i])); + +ret[0] = pts; +return 1073742001; +}if (distance == 0) { +if (ap31 == null) { +var d2 = 3.4028235E38; +var pt3 = null; +for (var i = ap3.length; --i >= 0; ) { +var pta = ap3[i]; +distance = pta.distanceSquared(pt); +if (distance < d2) { +pt3 = pta; +d2 = distance; +}} +ret[0] = (pt3 == null ? "" : pt3); +return (pt3 == null ? 4 : 134217751); +}var ptsOut = Clazz.newIntArray (ap31.length, 0); +for (var i = ptsOut.length; --i >= 0; ) { +var d2 = 3.4028235E38; +var imin = -1; +pt = ap31[i]; +for (var j = ap3.length; --j >= 0; ) { +var pta = ap3[j]; +distance = pta.distanceSquared(pt); +if (distance < d2) { +imin = j; +d2 = distance; +}} +ptsOut[i] = imin; +} +ret[0] = ptsOut; +return 1275068418; +}for (var i = ap3.length; --i >= 0; ) bspt.addTuple(ap3[i]); + +iter = bspt.allocateCubeIterator(); +iter.initialize(pt, distance, false); +var d2 = distance * distance; +while (iter.hasMoreElements()) { +var pt2 = iter.nextElement(); +if (pt2.distanceSquared(pt) <= d2) pts.addLast(pt2); +} +iter.release(); +ret[0] = pts; +return 1073742001; +}, "~N,JU.P3,~A,~A,JU.BS,~A"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/bspt/package.html b/config/plugins/visualizations/jmol/static/j2s/J/bspt/package.html new file mode 100755 index 000000000000..84a3f4c08c13 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/bspt/package.html @@ -0,0 +1,45 @@ + + + + + + + + + Provides Binary Space Partitioning Functionality to spacially + separate data structures in n-dimensions +
+ ++ For some useful background info, search the web for "bsp tree faq". +
+ + + + diff --git a/config/plugins/visualizations/jmol/static/j2s/J/c/CBK.js b/config/plugins/visualizations/jmol/static/j2s/J/c/CBK.js new file mode 100755 index 000000000000..154e8188c3c5 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/c/CBK.js @@ -0,0 +1,47 @@ +Clazz.declarePackage("J.c"); +Clazz.load(["java.lang.Enum"], "J.c.CBK", ["JU.SB"], function(){ +var c$ = Clazz.declareType(J.c, "CBK", Enum); +c$.getCallback = Clazz.defineMethod(c$, "getCallback", +function(name){ +name = name.toUpperCase(); +var pt = name.indexOf("CALLBACK"); +if (pt > 0) name = name.substring(0, pt); +for (var item, $item = 0, $$item = J.c.CBK.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.name().equalsIgnoreCase(name)) return item; + +return null; +}, "~S"); +c$.getNameList = Clazz.defineMethod(c$, "getNameList", +function(){ +if (J.c.CBK.nameList == null) { +var names = new JU.SB(); +for (var item, $item = 0, $$item = J.c.CBK.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) names.append(item.name().toLowerCase()).append("Callback;"); + +J.c.CBK.nameList = names.toString(); +}return J.c.CBK.nameList; +}); +c$.nameList = null; +Clazz.defineEnumConstant(c$, "ANIMFRAME", 0, []); +Clazz.defineEnumConstant(c$, "APPLETREADY", 1, []); +Clazz.defineEnumConstant(c$, "ATOMMOVED", 2, []); +Clazz.defineEnumConstant(c$, "AUDIO", 3, []); +Clazz.defineEnumConstant(c$, "CLICK", 4, []); +Clazz.defineEnumConstant(c$, "DRAGDROP", 5, []); +Clazz.defineEnumConstant(c$, "ECHO", 6, []); +Clazz.defineEnumConstant(c$, "ERROR", 7, []); +Clazz.defineEnumConstant(c$, "EVAL", 8, []); +Clazz.defineEnumConstant(c$, "HOVER", 9, []); +Clazz.defineEnumConstant(c$, "IMAGE", 10, []); +Clazz.defineEnumConstant(c$, "LOADSTRUCT", 11, []); +Clazz.defineEnumConstant(c$, "MEASURE", 12, []); +Clazz.defineEnumConstant(c$, "MESSAGE", 13, []); +Clazz.defineEnumConstant(c$, "MINIMIZATION", 14, []); +Clazz.defineEnumConstant(c$, "MODELKIT", 15, []); +Clazz.defineEnumConstant(c$, "PICK", 16, []); +Clazz.defineEnumConstant(c$, "RESIZE", 17, []); +Clazz.defineEnumConstant(c$, "SCRIPT", 18, []); +Clazz.defineEnumConstant(c$, "SELECT", 19, []); +Clazz.defineEnumConstant(c$, "SERVICE", 20, []); +Clazz.defineEnumConstant(c$, "STRUCTUREMODIFIED", 21, []); +Clazz.defineEnumConstant(c$, "SYNC", 22, []); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/c/FIL.js b/config/plugins/visualizations/jmol/static/j2s/J/c/FIL.js new file mode 100755 index 000000000000..b51f61a55601 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/c/FIL.js @@ -0,0 +1,20 @@ +Clazz.declarePackage("J.c"); +Clazz.load(["java.lang.Enum"], "J.c.FIL", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.code = 0; +Clazz.instantialize(this, arguments);}, J.c, "FIL", Enum); +Clazz.defineMethod(c$, "getCode", +function(){ +return this.code; +}); +Clazz.makeConstructor(c$, +function(code){ +this.code = code; +}, "~N"); +Clazz.defineEnumConstant(c$, "DELETED", 0, [5]); +Clazz.defineEnumConstant(c$, "CREATED", 1, [3]); +Clazz.defineEnumConstant(c$, "CREATING_MODELSET", 2, [2]); +Clazz.defineEnumConstant(c$, "ZAPPED", 3, [0]); +Clazz.defineEnumConstant(c$, "NOT_LOADED", 4, [-1]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/c/HB.js b/config/plugins/visualizations/jmol/static/j2s/J/c/HB.js new file mode 100755 index 000000000000..2270b02eb009 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/c/HB.js @@ -0,0 +1,57 @@ +Clazz.declarePackage("J.c"); +Clazz.load(["java.lang.Enum"], "J.c.HB", null, function(){ +var c$ = Clazz.declareType(J.c, "HB", Enum); +c$.getType = Clazz.defineMethod(c$, "getType", +function(atom){ +var group = atom.group; +var considerHydrogens = !atom.isHetero(); +switch (atom.getElementNumber()) { +default: +return J.c.HB.NOT; +case 1: +if (atom.getCovalentBondCount() == 0) return J.c.HB.DONOR; +var bonds = atom.bonds; +if (bonds == null) return J.c.HB.NOT; +switch (bonds[0].getOtherAtom(atom).getElementNumber()) { +case 7: +case 8: +case 16: +return J.c.HB.DONOR; +} +return J.c.HB.NOT; +case 7: +if (atom === group.getNitrogenAtom()) return J.c.HB.DONOR; +if (group.groupID == 9) return J.c.HB.UNKNOWN; +if (atom.getCovalentHydrogenCount() > 0) return J.c.HB.DONOR; +if (considerHydrogens) return J.c.HB.ACCEPTOR; +switch (group.groupID) { +case 2: +case 3: +case 12: +case 6: +case 19: +return J.c.HB.DONOR; +} +return J.c.HB.UNKNOWN; +case 8: +if (atom === group.getCarbonylOxygenAtom() || atom.getFormalCharge() == -1) return J.c.HB.ACCEPTOR; +if (atom.getCovalentBondCount() == 0 || atom.getCovalentHydrogenCount() > 0) return J.c.HB.UNKNOWN; +if (considerHydrogens) return J.c.HB.ACCEPTOR; +switch (group.groupID) { +case 4: +case 7: +return J.c.HB.ACCEPTOR; +} +return J.c.HB.UNKNOWN; +} +}, "JM.Atom"); +c$.isPossibleHBond = Clazz.defineMethod(c$, "isPossibleHBond", +function(typeA, typeB){ +return (typeA === J.c.HB.NOT || typeB === J.c.HB.NOT ? false : typeA === J.c.HB.UNKNOWN || typeA !== typeB); +}, "J.c.HB,J.c.HB"); +Clazz.defineEnumConstant(c$, "NOT", 0, []); +Clazz.defineEnumConstant(c$, "ACCEPTOR", 1, []); +Clazz.defineEnumConstant(c$, "DONOR", 2, []); +Clazz.defineEnumConstant(c$, "UNKNOWN", 3, []); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/c/PAL.js b/config/plugins/visualizations/jmol/static/j2s/J/c/PAL.js new file mode 100755 index 000000000000..f6148fc58af5 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/c/PAL.js @@ -0,0 +1,93 @@ +Clazz.declarePackage("J.c"); +Clazz.load(["java.lang.Enum"], "J.c.PAL", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.$$name = null; +this.id = 0; +Clazz.instantialize(this, arguments);}, J.c, "PAL", Enum); +Clazz.makeConstructor(c$, +function(name, id){ +this.$$name = name; +this.id = id; +}, "~S,~N"); +c$.pidOf = Clazz.defineMethod(c$, "pidOf", +function(value){ +return (Clazz.instanceOf(value,"J.c.PAL") ? (value).id : Clazz.instanceOf(value, Byte) ? (value).byteValue() : J.c.PAL.UNKNOWN.id); +}, "~O"); +c$.isPaletteVariable = Clazz.defineMethod(c$, "isPaletteVariable", +function(pid){ +return ((pid & 64) != 0); +}, "~N"); +c$.getPalette = Clazz.defineMethod(c$, "getPalette", +function(paletteName){ +if (paletteName.indexOf('_') < 0) for (var item, $item = 0, $$item = J.c.PAL.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (paletteName.equalsIgnoreCase(item.$$name)) return item; + +return (paletteName.indexOf("property_") == 0 ? J.c.PAL.PROPERTY : J.c.PAL.UNKNOWN); +}, "~S"); +c$.getPaletteID = Clazz.defineMethod(c$, "getPaletteID", +function(paletteName){ +if (paletteName.indexOf('_') < 0) for (var item, $item = 0, $$item = J.c.PAL.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (paletteName.equalsIgnoreCase(item.$$name)) return item.id; + +return (paletteName.indexOf("property_") == 0 ? J.c.PAL.PROPERTY.id : J.c.PAL.UNKNOWN.id); +}, "~S"); +c$.getPaletteName = Clazz.defineMethod(c$, "getPaletteName", +function(pid){ +for (var item, $item = 0, $$item = J.c.PAL.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.id == pid) return item.$$name; + +return null; +}, "~N"); +c$.PALETTE_VOLATILE = 0x40; +c$.PALETTE_NONE = 0; +c$.PALETTE_CPK = 1; +c$.PALETTE_PARTIAL_CHARGE = 2; +c$.PALETTE_FORMAL_CHARGE = 3; +c$.PALETTE_TEMP = 68; +c$.PALETTE_FIXEDTEMP = 5; +c$.PALETTE_SURFACE = 70; +c$.PALETTE_STRUCTURE = 7; +c$.PALETTE_AMINO = 8; +c$.PALETTE_SHAPELY = 9; +c$.PALETTE_CHAIN = 10; +c$.PALETTE_GROUP = 75; +c$.PALETTE_MONOMER = 76; +c$.PALETTE_MOLECULE = 77; +c$.PALETTE_ALTLOC = 14; +c$.PALETTE_INSERTION = 15; +c$.PALETTE_JMOL = 16; +c$.PALETTE_RASMOL = 17; +c$.PALETTE_TYPE = 18; +c$.PALETTE_ENERGY = 19; +c$.PALETTE_PROPERTY = 84; +c$.PALETTE_VARIABLE = 85; +c$.PALETTE_STRAIGHTNESS = 86; +c$.PALETTE_POLYMER = 87; +c$.PALETTE_NUCLEIC = 24; +c$.argbsCpkRasmol = Clazz.newIntArray(-1, [16716947, 33554431, 50315467, 62005794, 83951360, 113821896, 126849023, 149946368, 165324064, 184549631, 203590434, 226525328, 249210144, 268412160, 285198386, 285277952, 343965840, 377520272, 411074704, 427851920, 452961536, 480586282, 497363498, 514140714, 598026794, 796950672, 899686640, 956278016, 1339729184]); +c$.argbsCpk = Clazz.newIntArray(-1, [0xFFFF1493, 0xFFFFFFFF, 0xFFD9FFFF, 0xFFCC80FF, 0xFFC2FF00, 0xFFFFB5B5, 0xFF909090, 0xFF3050F8, 0xFFFF0D0D, 0xFF90E050, 0xFFB3E3F5, 0xFFAB5CF2, 0xFF8AFF00, 0xFFBFA6A6, 0xFFF0C8A0, 0xFFFF8000, 0xFFFFFF30, 0xFF1FF01F, 0xFF80D1E3, 0xFF8F40D4, 0xFF3DFF00, 0xFFE6E6E6, 0xFFBFC2C7, 0xFFA6A6AB, 0xFF8A99C7, 0xFF9C7AC7, 0xFFE06633, 0xFFF090A0, 0xFF50D050, 0xFFC88033, 0xFF7D80B0, 0xFFC28F8F, 0xFF668F8F, 0xFFBD80E3, 0xFFFFA100, 0xFFA62929, 0xFF5CB8D1, 0xFF702EB0, 0xFF00FF00, 0xFF94FFFF, 0xFF94E0E0, 0xFF73C2C9, 0xFF54B5B5, 0xFF3B9E9E, 0xFF248F8F, 0xFF0A7D8C, 0xFF006985, 0xFFC0C0C0, 0xFFFFD98F, 0xFFA67573, 0xFF668080, 0xFF9E63B5, 0xFFD47A00, 0xFF940094, 0xFF429EB0, 0xFF57178F, 0xFF00C900, 0xFF70D4FF, 0xFFFFFFC7, 0xFFD9FFC7, 0xFFC7FFC7, 0xFFA3FFC7, 0xFF8FFFC7, 0xFF61FFC7, 0xFF45FFC7, 0xFF30FFC7, 0xFF1FFFC7, 0xFF00FF9C, 0xFF00E675, 0xFF00D452, 0xFF00BF38, 0xFF00AB24, 0xFF4DC2FF, 0xFF4DA6FF, 0xFF2194D6, 0xFF267DAB, 0xFF266696, 0xFF175487, 0xFFD0D0E0, 0xFFFFD123, 0xFFB8B8D0, 0xFFA6544D, 0xFF575961, 0xFF9E4FB5, 0xFFAB5C00, 0xFF754F45, 0xFF428296, 0xFF420066, 0xFF007D00, 0xFF70ABFA, 0xFF00BAFF, 0xFF00A1FF, 0xFF008FFF, 0xFF0080FF, 0xFF006BFF, 0xFF545CF2, 0xFF785CE3, 0xFF8A4FE3, 0xFFA136D4, 0xFFB31FD4, 0xFFB31FBA, 0xFFB30DA6, 0xFFBD0D87, 0xFFC70066, 0xFFCC0059, 0xFFD1004F, 0xFFD90045, 0xFFE00038, 0xFFE6002E, 0xFFEB0026]); +Clazz.defineEnumConstant(c$, "UNKNOWN", 0, [null, 0xFF]); +Clazz.defineEnumConstant(c$, "NONE", 1, ["none", 0]); +Clazz.defineEnumConstant(c$, "CPK", 2, ["cpk", 1]); +Clazz.defineEnumConstant(c$, "PARTIAL_CHARGE", 3, ["partialcharge", 2]); +Clazz.defineEnumConstant(c$, "FORMAL_CHARGE", 4, ["formalcharge", 3]); +Clazz.defineEnumConstant(c$, "TEMP", 5, ["temperature", 68]); +Clazz.defineEnumConstant(c$, "FIXEDTEMP", 6, ["fixedtemperature", 5]); +Clazz.defineEnumConstant(c$, "SURFACE", 7, ["surfacedistance", 70]); +Clazz.defineEnumConstant(c$, "STRUCTURE", 8, ["structure", 7]); +Clazz.defineEnumConstant(c$, "AMINO", 9, ["amino", 8]); +Clazz.defineEnumConstant(c$, "SHAPELY", 10, ["shapely", 9]); +Clazz.defineEnumConstant(c$, "CHAIN", 11, ["chain", 10]); +Clazz.defineEnumConstant(c$, "GROUP", 12, ["group", 75]); +Clazz.defineEnumConstant(c$, "MONOMER", 13, ["monomer", 76]); +Clazz.defineEnumConstant(c$, "MOLECULE", 14, ["molecule", 77]); +Clazz.defineEnumConstant(c$, "ALTLOC", 15, ["altloc", 14]); +Clazz.defineEnumConstant(c$, "INSERTION", 16, ["insertion", 15]); +Clazz.defineEnumConstant(c$, "JMOL", 17, ["jmol", 16]); +Clazz.defineEnumConstant(c$, "RASMOL", 18, ["rasmol", 17]); +Clazz.defineEnumConstant(c$, "TYPE", 19, ["type", 18]); +Clazz.defineEnumConstant(c$, "ENERGY", 20, ["energy", 19]); +Clazz.defineEnumConstant(c$, "PROPERTY", 21, ["property", 84]); +Clazz.defineEnumConstant(c$, "VARIABLE", 22, ["variable", 85]); +Clazz.defineEnumConstant(c$, "STRAIGHTNESS", 23, ["straightness", 86]); +Clazz.defineEnumConstant(c$, "POLYMER", 24, ["polymer", 87]); +Clazz.defineEnumConstant(c$, "NUCLEIC", 25, ["nucleic", 24]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/c/STER.js b/config/plugins/visualizations/jmol/static/j2s/J/c/STER.js new file mode 100755 index 000000000000..724b5207cfac --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/c/STER.js @@ -0,0 +1,34 @@ +Clazz.declarePackage("J.c"); +Clazz.load(["java.lang.Enum"], "J.c.STER", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.$$name = null; +this.$isBiColor = false; +Clazz.instantialize(this, arguments);}, J.c, "STER", Enum); +Clazz.makeConstructor(c$, +function(name, isBiColor){ +this.$$name = name; +this.$isBiColor = isBiColor; +}, "~S,~B"); +Clazz.defineMethod(c$, "getName", +function(){ +return this.$$name; +}); +Clazz.defineMethod(c$, "isBiColor", +function(){ +return this.$isBiColor; +}); +c$.getStereoMode = Clazz.defineMethod(c$, "getStereoMode", +function(id){ +for (var item, $item = 0, $$item = J.c.STER.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.$$name.equalsIgnoreCase(id)) return item; + +return null; +}, "~S"); +Clazz.defineEnumConstant(c$, "NONE", 0, ["OFF", false]); +Clazz.defineEnumConstant(c$, "DOUBLE", 1, ["", false]); +Clazz.defineEnumConstant(c$, "REDCYAN", 2, ["REDCYAN", true]); +Clazz.defineEnumConstant(c$, "REDBLUE", 3, ["REDBLUE", true]); +Clazz.defineEnumConstant(c$, "REDGREEN", 4, ["REDGREEN", true]); +Clazz.defineEnumConstant(c$, "DTI", 5, ["DTI", false]); +Clazz.defineEnumConstant(c$, "CUSTOM", 6, ["", true]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/c/STR.js b/config/plugins/visualizations/jmol/static/j2s/J/c/STR.js new file mode 100755 index 000000000000..29a7a4c29f8e --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/c/STR.js @@ -0,0 +1,47 @@ +Clazz.declarePackage("J.c"); +Clazz.load(["java.lang.Enum"], "J.c.STR", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.id = 0; +this.color = 0; +Clazz.instantialize(this, arguments);}, J.c, "STR", Enum); +Clazz.makeConstructor(c$, +function(id, color){ +this.id = id; +this.color = color; +}, "~N,~N"); +Clazz.defineMethod(c$, "getId", +function(){ +return this.id; +}); +Clazz.defineMethod(c$, "getColor", +function(){ +return this.color; +}); +c$.getProteinStructureType = Clazz.defineMethod(c$, "getProteinStructureType", +function(name){ +for (var item, $item = 0, $$item = J.c.STR.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (name.equalsIgnoreCase(item.name())) return (item.isProtein() ? item : J.c.STR.NOT); + +return J.c.STR.NOT; +}, "~S"); +Clazz.defineMethod(c$, "getBioStructureTypeName", +function(isGeneric){ +return (this.id < 0 ? "" : isGeneric && this.isProtein() ? "protein" : this.name()); +}, "~B"); +Clazz.defineMethod(c$, "isProtein", +function(){ +return this.id >= 0 && this.id <= 3 || this.id >= 7; +}); +Clazz.defineEnumConstant(c$, "NOT", 0, [-1, 0xFF808080]); +Clazz.defineEnumConstant(c$, "NONE", 1, [0, 0xFFFFFFFF]); +Clazz.defineEnumConstant(c$, "TURN", 2, [1, 0xFF6080FF]); +Clazz.defineEnumConstant(c$, "SHEET", 3, [2, 0xFFFFC800]); +Clazz.defineEnumConstant(c$, "HELIX", 4, [3, 0xFFFF0080]); +Clazz.defineEnumConstant(c$, "DNA", 5, [4, 0xFFAE00FE]); +Clazz.defineEnumConstant(c$, "RNA", 6, [5, 0xFFFD0162]); +Clazz.defineEnumConstant(c$, "CARBOHYDRATE", 7, [6, 0xFFA6A6FA]); +Clazz.defineEnumConstant(c$, "HELIX310", 8, [7, 0xFFA00080]); +Clazz.defineEnumConstant(c$, "HELIXALPHA", 9, [8, 0xFFFF0080]); +Clazz.defineEnumConstant(c$, "HELIXPI", 10, [9, 0xFF600080]); +Clazz.defineEnumConstant(c$, "ANNOTATION", 11, [-2, 0]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/c/VDW.js b/config/plugins/visualizations/jmol/static/j2s/J/c/VDW.js new file mode 100755 index 000000000000..d76b1c88defc --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/c/VDW.js @@ -0,0 +1,47 @@ +Clazz.declarePackage("J.c"); +Clazz.load(["java.lang.Enum"], "J.c.VDW", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.pt = 0; +this.type = null; +this.type2 = null; +Clazz.instantialize(this, arguments);}, J.c, "VDW", Enum); +Clazz.makeConstructor(c$, +function(pt, type, type2){ +this.pt = pt; +this.type = type; +this.type2 = type2; +}, "~N,~S,~S"); +Clazz.defineMethod(c$, "getVdwLabel", +function(){ +return (this.type == null ? this.type2 : this.type); +}); +c$.getVdwType = Clazz.defineMethod(c$, "getVdwType", +function(label){ +if (label != null) for (var item, $item = 0, $$item = J.c.VDW.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (label.equalsIgnoreCase(item.type)) return item; + +return null; +}, "~S"); +c$.getVdwType2 = Clazz.defineMethod(c$, "getVdwType2", +function(label){ +if (label != null) for (var item, $item = 0, $$item = J.c.VDW.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (label.equalsIgnoreCase(item.type2)) return item; + +return null; +}, "~S"); +Clazz.defineEnumConstant(c$, "JMOL", 0, [0, "Jmol", null]); +Clazz.defineEnumConstant(c$, "BABEL", 1, [1, "Babel", null]); +Clazz.defineEnumConstant(c$, "RASMOL", 2, [2, "RasMol", null]); +Clazz.defineEnumConstant(c$, "BABEL21", 3, [3, "Babel21", null]); +Clazz.defineEnumConstant(c$, "AUTO_JMOL", 4, [0, null, "Jmol"]); +Clazz.defineEnumConstant(c$, "AUTO_BABEL", 5, [1, null, "Babel"]); +Clazz.defineEnumConstant(c$, "AUTO_RASMOL", 6, [2, null, "RasMol"]); +Clazz.defineEnumConstant(c$, "AUTO", 7, [0, "Auto", null]); +Clazz.defineEnumConstant(c$, "USER", 8, [-1, "User", null]); +Clazz.defineEnumConstant(c$, "ADPMAX", 9, [-1, null, "adpmax"]); +Clazz.defineEnumConstant(c$, "ADPMIN", 10, [-1, null, "adpmin"]); +Clazz.defineEnumConstant(c$, "HYDRO", 11, [-1, null, "hydrophobic"]); +Clazz.defineEnumConstant(c$, "BONDING", 12, [-1, null, "bondingradius"]); +Clazz.defineEnumConstant(c$, "TEMP", 13, [-1, null, "temperature"]); +Clazz.defineEnumConstant(c$, "NOJMOL", 14, [-1, null, null]); +Clazz.defineEnumConstant(c$, "NADA", 15, [-1, null, null]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/console/GenericConsole.js b/config/plugins/visualizations/jmol/static/j2s/J/console/GenericConsole.js new file mode 100755 index 000000000000..59e674b1d686 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/console/GenericConsole.js @@ -0,0 +1,404 @@ +Clazz.declarePackage("J.console"); +Clazz.load(["J.api.JmolAppConsoleInterface", "$.JmolCallbackListener", "java.util.Hashtable"], "J.console.GenericConsole", ["JU.PT", "J.c.CBK", "J.i18n.GT", "JS.T", "JV.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.input = null; +this.output = null; +this.vwr = null; +this.menuMap = null; +this.editButton = null; +this.runButton = null; +this.historyButton = null; +this.stateButton = null; +this.clearOutButton = null; +this.clearInButton = null; +this.loadButton = null; +this.defaultMessage = null; +this.label1 = null; +this.nTab = 0; +this.incompleteCmd = null; +Clazz.instantialize(this, arguments);}, J.console, "GenericConsole", null, [J.api.JmolAppConsoleInterface, J.api.JmolCallbackListener]); +Clazz.prepareFields (c$, function(){ +this.menuMap = new java.util.Hashtable(); +}); +Clazz.defineMethod(c$, "setViewer", +function(vwr){ +this.vwr = vwr; +if (J.console.GenericConsole.labels == null) { +var l = new java.util.Hashtable(); +l.put("title", J.i18n.GT.$("Jmol Script Console") + " " + JV.Viewer.getJmolVersion()); +this.setupLabels(l); +J.console.GenericConsole.labels = l; +}}, "JV.Viewer"); +Clazz.defineMethod(c$, "addButton", +function(b, label){ +b.addConsoleListener(this); +this.menuMap.put(label, b); +return b; +}, "J.api.JmolAbstractButton,~S"); +Clazz.defineMethod(c$, "getLabel1", +function(){ +return null; +}); +Clazz.defineMethod(c$, "setupLabels", +function(labels){ +labels.put("saveas", J.i18n.GT.$("&Save As...")); +labels.put("file", J.i18n.GT.$("&File")); +labels.put("close", J.i18n.GT.$("&Close")); +this.setupLabels0(labels); +}, "java.util.Map"); +Clazz.defineMethod(c$, "setupLabels0", +function(labels){ +labels.put("help", J.i18n.GT.$("&Help")); +labels.put("search", J.i18n.GT.$("&Search...")); +labels.put("commands", J.i18n.GT.$("&Commands")); +labels.put("functions", J.i18n.GT.$("Math &Functions")); +labels.put("parameters", J.i18n.GT.$("Set &Parameters")); +labels.put("more", J.i18n.GT.$("&More")); +labels.put("Editor", J.i18n.GT.$("Editor")); +labels.put("State", J.i18n.GT.$("State")); +labels.put("Run", J.i18n.GT.$("Run")); +labels.put("Clear Output", J.i18n.GT.$("Clear Output")); +labels.put("Clear Input", J.i18n.GT.$("Clear Input")); +labels.put("History", J.i18n.GT.$("History")); +labels.put("Load", J.i18n.GT.$("Load")); +labels.put("label1", J.i18n.GT.$("press CTRL-ENTER for new line or paste model data and press Load")); +labels.put("default", J.i18n.GT.$("Messages will appear here. Enter commands in the box below. Click the console Help menu item for on-line help, which will appear in a new browser window.")); +}, "java.util.Map"); +Clazz.defineMethod(c$, "setLabels", +function(){ +var doTranslate = J.i18n.GT.setDoTranslate(true); +this.editButton = this.setButton("Editor"); +this.stateButton = this.setButton("State"); +this.runButton = this.setButton("Run"); +this.clearOutButton = this.setButton("Clear Output"); +this.clearInButton = this.setButton("Clear Input"); +this.historyButton = this.setButton("History"); +this.loadButton = this.setButton("Load"); +this.defaultMessage = J.console.GenericConsole.getLabel("default"); +this.setTitle(); +J.i18n.GT.setDoTranslate(doTranslate); +}); +c$.getLabel = Clazz.defineMethod(c$, "getLabel", +function(key){ +return J.console.GenericConsole.labels.get(key); +}, "~S"); +Clazz.defineMethod(c$, "displayConsole", +function(){ +this.layoutWindow(null); +this.outputMsg(this.defaultMessage); +}); +Clazz.defineMethod(c$, "updateLabels", +function(){ +return; +}); +Clazz.defineMethod(c$, "completeCommand", +function(thisCmd){ +if (thisCmd.length == 0) return null; +var strCommand = (this.nTab <= 0 || this.incompleteCmd == null ? thisCmd : this.incompleteCmd); +this.incompleteCmd = strCommand; +var splitCmd = J.console.GenericConsole.splitCommandLine(thisCmd); +if (splitCmd == null) return null; +var asCommand = splitCmd[2] == null; +var inBrace = (splitCmd[3] != null); +var notThis = splitCmd[asCommand ? 1 : 2]; +var s = splitCmd[1]; +if (notThis.length == 0) return null; +var token = JS.T.getTokenFromName(s.trim().toLowerCase()); +var cmdtok = (token == null ? 0 : token.tok); +var isSelect = JS.T.tokAttr(cmdtok, 12288); +splitCmd = J.console.GenericConsole.splitCommandLine(strCommand); +var cmd = null; +if (!asCommand && (notThis.charAt(0) == '"' || notThis.charAt(0) == '\'')) { +var q = notThis.charAt(0); +notThis = JU.PT.trim(notThis, "\"\'"); +var stub = JU.PT.trim(splitCmd[2], "\"\'"); +cmd = this.nextFileName(stub, this.nTab); +if (cmd != null) cmd = splitCmd[0] + splitCmd[1] + q + cmd + q; +} else { +var map = null; +if (!asCommand) { +notThis = s; +if (inBrace || splitCmd[2].startsWith("$") || isSelect) { +map = new java.util.Hashtable(); +this.vwr.getObjectMap(map, inBrace || isSelect ? '{' : splitCmd[2].startsWith("$") ? '$' : '0'); +}}cmd = JS.T.completeCommand(map, s.equalsIgnoreCase("set "), asCommand, asCommand ? splitCmd[1] : splitCmd[2], this.nTab); +cmd = splitCmd[0] + (cmd == null ? notThis : asCommand ? cmd : splitCmd[1] + cmd); +}return (cmd == null || cmd.equals(strCommand) ? null : cmd); +}, "~S"); +Clazz.defineMethod(c$, "doAction", +function(source){ +if (source === this.runButton) { +this.execute(null); +} else if (source === this.editButton) { +this.vwr.getProperty("DATA_API", "scriptEditor", null); +} else if (source === this.historyButton) { +this.clearContent(this.vwr.getSetHistory(2147483647)); +} else if (source === this.stateButton) { +this.clearContent(this.vwr.getStateInfo()); +} else if (source === this.clearInButton) { +this.input.setText(""); +return; +}if (source === this.clearOutButton) { +this.output.setText(""); +return; +}if (source === this.loadButton) { +this.vwr.loadInlineAppend(this.input.getText(), false); +return; +}if (this.isMenuItem(source)) { +this.execute((source).getName()); +return; +}}, "~O"); +Clazz.defineMethod(c$, "execute", +function(strCommand){ +var cmd = (strCommand == null ? this.input.getText() : strCommand); +if (strCommand == null) this.input.setText(null); +var strErrorMessage = this.vwr.script(cmd + "; ## GUI ##\u0001## EDITOR_IGNORE ##; ## GUI ##"); +if (strErrorMessage != null && !strErrorMessage.equals("pending")) this.outputMsg(strErrorMessage); +}, "~S"); +Clazz.defineMethod(c$, "destroyConsole", +function(){ +if (this.vwr.isApplet) this.vwr.getProperty("DATA_API", "getAppConsole", Boolean.FALSE); +}); +c$.setAbstractButtonLabels = Clazz.defineMethod(c$, "setAbstractButtonLabels", +function(menuMap, labels){ +for (var key, $key = menuMap.keySet().iterator (); $key.hasNext()&& ((key = $key.next ()) || true);) { +var m = menuMap.get(key); +var label = labels.get(key); +if (key.indexOf("Tip") == key.length - 3) { +m.setToolTipText(labels.get(key)); +} else { +var mnemonic = J.console.GenericConsole.getMnemonic(label); +if (mnemonic != ' ') m.setMnemonic(mnemonic); +label = J.console.GenericConsole.getLabelWithoutMnemonic(label); +m.setText(label); +}} +}, "java.util.Map,java.util.Map"); +c$.getLabelWithoutMnemonic = Clazz.defineMethod(c$, "getLabelWithoutMnemonic", +function(label){ +if (label == null) { +return null; +}var index = label.indexOf('&'); +if (index == -1) { +return label; +}return label.substring(0, index) + ((index < label.length - 1) ? label.substring(index + 1) : ""); +}, "~S"); +c$.getMnemonic = Clazz.defineMethod(c$, "getMnemonic", +function(label){ +if (label == null) { +return ' '; +}var index = label.indexOf('&'); +if ((index == -1) || (index == label.length - 1)) { +return ' '; +}return label.charAt(index + 1); +}, "~S"); +c$.map = Clazz.defineMethod(c$, "map", +function(button, key, label, menuMap){ +var mnemonic = J.console.GenericConsole.getMnemonic(label); +if (mnemonic != ' ') (button).setMnemonic(mnemonic); +if (menuMap != null) menuMap.put(key, button); +}, "~O,~S,~S,java.util.Map"); +Clazz.overrideMethod(c$, "notifyEnabled", +function(type){ +switch (type) { +case J.c.CBK.ECHO: +case J.c.CBK.MEASURE: +case J.c.CBK.MESSAGE: +case J.c.CBK.PICK: +return true; +case J.c.CBK.ANIMFRAME: +case J.c.CBK.APPLETREADY: +case J.c.CBK.ATOMMOVED: +case J.c.CBK.AUDIO: +case J.c.CBK.CLICK: +case J.c.CBK.DRAGDROP: +case J.c.CBK.ERROR: +case J.c.CBK.EVAL: +case J.c.CBK.HOVER: +case J.c.CBK.IMAGE: +case J.c.CBK.LOADSTRUCT: +case J.c.CBK.MINIMIZATION: +case J.c.CBK.MODELKIT: +case J.c.CBK.SERVICE: +case J.c.CBK.RESIZE: +case J.c.CBK.SCRIPT: +case J.c.CBK.SELECT: +case J.c.CBK.STRUCTUREMODIFIED: +case J.c.CBK.SYNC: +break; +} +return false; +}, "J.c.CBK"); +Clazz.overrideMethod(c$, "notifyCallback", +function(type, data){ +var strInfo = (data == null || data[1] == null ? null : data[1].toString()); +switch (type) { +case J.c.CBK.ECHO: +this.sendConsoleEcho(strInfo); +break; +case J.c.CBK.MEASURE: +var mystatus = data[3]; +if (mystatus.indexOf("Picked") >= 0 || mystatus.indexOf("Sequence") >= 0) this.sendConsoleMessage(strInfo); + else if (mystatus.indexOf("Completed") >= 0) this.sendConsoleEcho(strInfo); +break; +case J.c.CBK.MESSAGE: +this.sendConsoleMessage(data == null ? null : strInfo); +break; +case J.c.CBK.PICK: +this.sendConsoleMessage(strInfo); +break; +} +}, "J.c.CBK,~A"); +Clazz.overrideMethod(c$, "getText", +function(){ +return this.output.getText(); +}); +Clazz.overrideMethod(c$, "sendConsoleEcho", +function(strEcho){ +if (strEcho == null) { +this.updateLabels(); +this.outputMsg(null); +strEcho = this.defaultMessage; +} else if (strEcho.equals("\0")) { +{ +Clazz.Console.clear(); +}strEcho = null; +}this.outputMsg(strEcho); +}, "~S"); +Clazz.defineMethod(c$, "outputMsg", +function(message){ +var n = (message == null ? -1 : message.length); +switch (n) { +case -1: +this.output.setText(""); +return; +default: +if (message.charAt(n - 1) == '\n') break; +case 0: +message += "\n"; +} +this.output.append(message); +}, "~S"); +Clazz.defineMethod(c$, "clearContent", +function(text){ +this.output.setText(text); +}, "~S"); +Clazz.overrideMethod(c$, "sendConsoleMessage", +function(strInfo){ +if (strInfo != null && this.output.getText().startsWith(this.defaultMessage)) this.outputMsg(null); +this.outputMsg(strInfo); +}, "~S"); +Clazz.overrideMethod(c$, "setCallbackFunction", +function(callbackType, callbackFunction){ +}, "~S,~S"); +Clazz.overrideMethod(c$, "zap", +function(){ +}); +Clazz.defineMethod(c$, "recallCommand", +function(up, pageUp){ +var cmd = this.vwr.getSetHistory(up ? -1 : 1); +if (cmd != null) { +cmd = this.trimGUI(cmd); +this.input.setText(JU.PT.escUnicode(cmd)); +}}, "~B,~B"); +Clazz.defineMethod(c$, "trimGUI", +function(cmd){ +var pt = cmd.indexOf("\u0001##"); +if (pt >= 0) cmd = cmd.substring(0, pt); +pt = cmd.indexOf("; ## GUI ##"); +if (pt >= 0) cmd = cmd.substring(0, pt); +return JU.PT.trim(cmd, "; "); +}, "~S"); +Clazz.defineMethod(c$, "processKey", +function(kcode, kid, isControlDown){ +var mode = 0; +switch (kid) { +case 401: +switch (kcode) { +case 9: +var s = this.input.getText(); +if (s.endsWith("\n") || s.endsWith("\t")) return 0; +mode = 1; +if (this.input.getCaretPosition() == s.length) { +var cmd = this.completeCommand(s); +if (cmd != null) this.input.setText(JU.PT.escUnicode(cmd).$replace('\t', ' ')); +this.nTab++; +return mode; +}break; +case 27: +mode = 1; +this.input.setText(""); +break; +} +this.nTab = 0; +if (kcode == 10 && !isControlDown) { +this.execute(null); +return mode; +}if (kcode == 38 || kcode == 40) { +this.recallCommand(kcode == 38, false); +return mode; +}break; +case 402: +if (kcode == 10 && !isControlDown) return mode; +break; +} +return mode | 2; +}, "~N,~N,~B"); +c$.splitCommandLine = Clazz.defineMethod(c$, "splitCommandLine", +function(cmd){ +var sout = new Array(4); +var isEscaped1 = false; +var isEscaped2 = false; +var isEscaped = false; +if (cmd.length == 0) return null; +var ptQ = -1; +var ptCmd = 0; +var ptToken = 0; +var nBrace = 0; +var ch; +for (var i = 0; i < cmd.length; i++) { +switch ((ch = cmd.charAt(i)).charCodeAt(0)) { +case 34: +if (!isEscaped && !isEscaped1) { +isEscaped2 = !isEscaped2; +if (isEscaped2) ptQ = ptToken = i; +}break; +case 39: +if (!isEscaped && !isEscaped2) { +isEscaped1 = !isEscaped1; +if (isEscaped1) ptQ = ptToken = i; +}break; +case 92: +isEscaped = !isEscaped; +continue; +case 32: +if (!isEscaped && !isEscaped1 && !isEscaped2) { +ptToken = i + 1; +ptQ = -1; +}break; +case 59: +if (!isEscaped1 && !isEscaped2) { +ptCmd = ptToken = i + 1; +ptQ = -1; +nBrace = 0; +}break; +case 123: +case 125: +if (!isEscaped1 && !isEscaped2) { +nBrace += (ch == '{' ? 1 : -1); +ptToken = i + 1; +ptQ = -1; +}break; +default: +if (!isEscaped1 && !isEscaped2) ptQ = -1; +} +isEscaped = false; +} +sout[0] = cmd.substring(0, ptCmd); +sout[1] = (ptToken == ptCmd ? cmd.substring(ptCmd) : cmd.substring(ptCmd, (ptToken > ptQ ? ptToken : ptQ))); +sout[2] = (ptToken == ptCmd ? null : cmd.substring(ptToken)); +sout[3] = (nBrace > 0 ? "{" : null); +return sout; +}, "~S"); +c$.labels = null; +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/console/GenericTextArea.js b/config/plugins/visualizations/jmol/static/j2s/J/console/GenericTextArea.js new file mode 100755 index 000000000000..13398b6ee370 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/console/GenericTextArea.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.console"); +Clazz.declareInterface(J.console, "GenericTextArea"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/console/ImageDialog.js b/config/plugins/visualizations/jmol/static/j2s/J/console/ImageDialog.js new file mode 100755 index 000000000000..abb13fd38716 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/console/ImageDialog.js @@ -0,0 +1,158 @@ +Clazz.declarePackage("J.console"); +Clazz.load(["javax.swing.JDialog", "$.JPanel", "J.api.GenericImageDialog"], "J.console.ImageDialog", ["java.util.Hashtable", "JU.PT", "javax.swing.JMenuBar", ], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.menubar = null; +this.image = null; +this.vwr = null; +this.canvas = null; +this.$title = null; +this.imageMap = null; +this.console = null; +if (!Clazz.isClassDefined("J.console.ImageDialog.ImageCanvas")) { +J.console.ImageDialog.$ImageDialog$ImageCanvas$ (); +} +Clazz.instantialize(this, arguments);}, J.console, "ImageDialog", javax.swing.JDialog, [J.api.GenericImageDialog, java.awt.event.WindowListener, java.awt.event.ActionListener]); +Clazz.makeConstructor(c$, +function(vwr, title, imageMap){ +Clazz.superConstructor(this, J.console.ImageDialog, [Clazz.instanceOf(J.awt.Platform.getWindow(vwr.display),"javax.swing.JFrame") ? J.awt.Platform.getWindow(vwr.display) : null, title, false]); +this.vwr = vwr; +this.setResizable(false); +this.console = vwr.getConsole(); +this.addWindowListener(this); +this.$title = title; +this.imageMap = imageMap; +imageMap.put(title, this); +var wrapper = new javax.swing.JPanel( new java.awt.BorderLayout()); +wrapper.setBackground( new java.awt.Color(255, 0, 0)); +this.canvas = Clazz.innerTypeInstance(J.console.ImageDialog.ImageCanvas, this, null); +wrapper.add(this.canvas, "Center"); +var container = new javax.swing.JPanel(); +container.setLayout( new java.awt.BorderLayout()); +this.menubar = new javax.swing.JMenuBar(); +this.menubar.add(this.createMenu()); +this.setJMenuBar(this.menubar); +container.add(wrapper, "Center"); +this.getContentPane().add(container); +this.pack(); +this.setLocation(100, 100); +this.setVisible(true); +}, "JV.Viewer,~S,java.util.Map"); +Clazz.defineMethod(c$, "createMenu", +function(){ +var itemKeys = JU.PT.getTokens("saveas close"); +this.vwr.getConsole(); +var menu = this.console.newJMenu("file"); +for (var i = 0; i < itemKeys.length; i++) { +var item = itemKeys[i]; +var mi = this.createMenuItem(item); +menu.add(mi); +} +menu.setVisible(true); +return menu; +}); +Clazz.defineMethod(c$, "createMenuItem", +function(cmd){ +var mi = this.console.newJMenuItem(cmd); +mi.setActionCommand(cmd); +mi.addActionListener(this); +mi.setVisible(true); +return mi; +}, "~S"); +Clazz.overrideMethod(c$, "actionPerformed", +function(e){ +var cmd = e.getActionCommand(); +if (cmd.equals("close")) { +this.closeMe(); +} else if (cmd.equals("saveas")) { +this.saveAs(); +}}, "java.awt.event.ActionEvent"); +Clazz.defineMethod(c$, "saveAs", +function(){ +(((Clazz.isClassDefined("J.console.ImageDialog$2") ? 0 : J.console.ImageDialog.$ImageDialog$2$ ()), Clazz.innerTypeInstance(J.console.ImageDialog$2, this, null, ((Clazz.isClassDefined("J.console.ImageDialog$1") ? 0 : J.console.ImageDialog.$ImageDialog$1$ ()), Clazz.innerTypeInstance(J.console.ImageDialog$1, this, null))))).start(); +}); +Clazz.overrideMethod(c$, "closeMe", +function(){ +this.imageMap.remove(this.$title); +this.dispose(); +}); +Clazz.overrideMethod(c$, "setImage", +function(oimage){ +if (oimage == null) { +this.closeMe(); +return; +}var w = (oimage).getWidth(null); +var h = (oimage).getHeight(null); +this.image = new java.awt.image.BufferedImage(w, h, 1); +var g = this.image.getGraphics(); +g.setColor(java.awt.Color.white); +g.fillRect(0, 0, w, h); +g.drawImage(oimage, 0, 0, null); +g.dispose(); +this.setTitle(this.$title + " [" + w + " x " + h + "]"); +var d = new java.awt.Dimension(w, h); +this.canvas.setPreferredSize(d); +this.setBackground(java.awt.Color.WHITE); +this.getContentPane().setBackground(java.awt.Color.WHITE); +this.pack(); +}, "~O"); +Clazz.overrideMethod(c$, "windowClosed", +function(e){ +}, "java.awt.event.WindowEvent"); +Clazz.overrideMethod(c$, "windowOpened", +function(e){ +}, "java.awt.event.WindowEvent"); +Clazz.overrideMethod(c$, "windowClosing", +function(e){ +this.closeMe(); +}, "java.awt.event.WindowEvent"); +Clazz.overrideMethod(c$, "windowIconified", +function(e){ +}, "java.awt.event.WindowEvent"); +Clazz.overrideMethod(c$, "windowDeiconified", +function(e){ +}, "java.awt.event.WindowEvent"); +Clazz.overrideMethod(c$, "windowActivated", +function(e){ +}, "java.awt.event.WindowEvent"); +Clazz.overrideMethod(c$, "windowDeactivated", +function(e){ +}, "java.awt.event.WindowEvent"); +c$.$ImageDialog$ImageCanvas$ = function(){ +/*if4*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +Clazz.prepareCallback(this, arguments); +Clazz.instantialize(this, arguments);}, J.console.ImageDialog, "ImageCanvas", javax.swing.JPanel); +Clazz.overrideMethod(c$, "paintComponent", +function(g){ +System.out.println(this.b$["J.console.ImageDialog"].image.getClass().getName()); +g.setColor(java.awt.Color.white); +g.fillRect(0, 0, this.b$["J.console.ImageDialog"].image.getWidth(null), this.b$["J.console.ImageDialog"].image.getHeight(null)); +g.drawImage(this.b$["J.console.ImageDialog"].image, 0, 0, null); +}, "java.awt.Graphics"); +/*eoif4*/})(); +}; +c$.$ImageDialog$2$=function(){ +/*if5*/;(function(){ +var c$ = Clazz.declareAnonymous(J.console, "ImageDialog$2", Thread); +/*eoif5*/})(); +}; +c$.$ImageDialog$1$=function(){ +/*if5*/;(function(){ +var c$ = Clazz.declareAnonymous(J.console, "ImageDialog$1", null, Runnable); +Clazz.overrideMethod(c$, "run", +function(){ +var params = new java.util.Hashtable(); +var fname = this.b$["J.console.ImageDialog"].vwr.dialogAsk("Save Image", "jmol.png", params); +if (fname == null) return; +var type = "PNG"; +var pt = fname.lastIndexOf("."); +if (pt > 0) type = fname.substring(pt + 1).toUpperCase(); +params.put("fileName", fname); +params.put("type", type); +params.put("image", this.b$["J.console.ImageDialog"].image); +this.b$["J.console.ImageDialog"].vwr.showString(this.b$["J.console.ImageDialog"].vwr.processWriteOrCapture(params), false); +}); +/*eoif5*/})(); +}; +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/consolejs/AppletConsole.js b/config/plugins/visualizations/jmol/static/j2s/J/consolejs/AppletConsole.js new file mode 100755 index 000000000000..df4ac5a04e16 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/consolejs/AppletConsole.js @@ -0,0 +1,365 @@ +Clazz.declarePackage("J.consolejs"); +Clazz.load(["J.console.GenericConsole"], "J.consolejs.AppletConsole", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.jsConsole = null; +Clazz.instantialize(this, arguments);}, J.consolejs, "AppletConsole", J.console.GenericConsole); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.consolejs.AppletConsole, []); +}); +Clazz.overrideMethod(c$, "start", +function(vwr){ +this.setViewer(vwr); +this.setLabels(); +this.displayConsole(); +}, "JV.Viewer"); +Clazz.overrideMethod(c$, "layoutWindow", +function(enabledButtons){ +{ +this.jsConsole = new Jmol.Console.JSConsole(this); +}this.setTitle(); +}, "~S"); +Clazz.overrideMethod(c$, "setTitle", +function(){ +if (this.jsConsole != null) this.jsConsole.setTitle(J.console.GenericConsole.getLabel("title")); +}); +Clazz.overrideMethod(c$, "setVisible", +function(visible){ +this.jsConsole.setVisible(visible); +}, "~B"); +Clazz.overrideMethod(c$, "setButton", +function(text){ +{ +return new Jmol.Console.Button(text); +}}, "~S"); +Clazz.overrideMethod(c$, "dispose", +function(){ +this.setVisible(false); +}); +Clazz.overrideMethod(c$, "isMenuItem", +function(source){ +return false; +}, "~O"); +Clazz.overrideMethod(c$, "getScriptEditor", +function(){ +return null; +}); +Clazz.overrideMethod(c$, "nextFileName", +function(stub, nTab){ +return null; +}, "~S,~N"); +Clazz.overrideMethod(c$, "newJMenu", +function(key){ +return null; +}, "~S"); +Clazz.overrideMethod(c$, "newJMenuItem", +function(key){ +return null; +}, "~S"); +Clazz.overrideMethod(c$, "regainFocus", +function(){ +}); +{ +{ +;Jmol.Console = { +buttons:{}, +buttonWidth:100, +click:function(id) { +Jmol.Console.buttons[id].console.appletConsole.doAction(Jmol.Console.buttons[id]); +} +} +Jmol.consoleGetImageDialog = function(vwr, title, imageMap) { +// JmolObjectInterface +return new Jmol.Console.Image(vwr, title, imageMap); +} +Jmol.Console.Image = function(vwr, title, imageMap) { +// page designer may indicate one of three divs for images on the page: +//_Image_app_holder for IMAGE command by itself (current app image) +// _Image_ _holder for IMAGE ID "xxx" ... or IMAGE "xxx" +// where cleaning is with .replace(/\W/g,"_") +// _Image_holder for all images not identified as above +// if a page div is not identified, then the image will be placed in a new floating div +this.vwr = vwr; +this.title = title; +this.imageMap = imageMap; +this.applet = vwr.html5Applet; +var id = this.applet._id + "_Image"; +this.id = id + "_" + (title == "" ? "app" : title).replace(/\W/g,"_"); +var jqobj = Jmol._$(this.id + "_holder"); +if (!jqobj[0] && (jqobj = Jmol._$(id + "_holder"))[0]) +this.id = id; +if (jqobj[0]) +this.div = jqobj; +else +Jmol.Console.createDOM(this, ' '); +System.out.println("image " + this.id + " created"); +var obj = imageMap.get(this.id); +if (obj) +obj.closeMe(); +imageMap.put(this.id, this); +imageMap.put(title, this); +} +Jmol.Console.Image.setCanvas = function(obj, canvas) { +// this method can be customized as desired +// it puts the canvas into a holder div +Jmol.$append(Jmol._$(obj.id + "_holder"), canvas); +Jmol.$html(obj.id + "_title", ""); +} +Jmol.Console.Image.closeImage = function(obj) { +// this method can be customized as desired +obj.imageMap.remove(obj.title); +obj.imageMap.remove(obj.id); +if (obj.div) { +Jmol.$remove(obj.cid); +} else { +obj.dragBind(false); +Jmol.$remove(obj.id); +} +} +Jmol.Console.Image.prototype.setImage = function(canvas) { +// called by Jmol asynchronously after image is loaded +if (this.cid) +Jmol.$remove(this.cid); +var c = document.createElement("canvas"); +c.width = canvas.width; +c.height = canvas.height; +var cdx = c.getContext("2d"); +if (canvas.buf32) { +// image buffer from current view +// (note that buf32.length will be the same as buf8.length when images are antialiased) +var imgData = cdx.getImageData(0, 0, c.width, c.height); +var buf8 = imgData.data; +var buf32 = canvas.buf32; +var n = buf8.length >> 2; +for (var i = 0, j = 0; i < n; i++) { +buf8[j++] = (buf32[i] >> 16) & 0xFF; +buf8[j++] = (buf32[i] >> 8) & 0xFF; +buf8[j++] = buf32[i] & 0xFF; +buf8[j++] = 0xFF; +} +cdx.putImageData(imgData, 0, 0); +} else { +// asynchronous load of image from file +cdx.drawImage(canvas,0,0); +} +this.cid = c.id = this.id + "_image"; +Jmol.Console.Image.setCanvas(this, c); +} +Jmol.Console.Image.prototype.closeMe = function() { +// called by Jmol +Jmol.Console.Image.closeImage(this); +} +Jmol.Swing.setDraggable(Jmol.Console.Image); +Jmol.Console.createDOM = function(obj, s, userConsole) { +var id = obj.id; +Jmol.Console.buttons[id] = obj; +s = s.replace(/\$ID/g,id); +if (userConsole && userConsole[0]) { +Jmol.$html(userConsole,s); +} else { +Jmol.$after("body", s); +obj.setContainer(Jmol._$(id)); +obj.setPosition(); +obj.dragBind(true); +} +} +Jmol.Console.JSConsole = function(appletConsole) { +this.applet = appletConsole.vwr.html5Applet; +var id = this.id = this.applet._id+"_console"; +var console = this; +console.appletConsole = appletConsole; +console.input = appletConsole.input = new Jmol.Console.Input(console); +console.output = appletConsole.output = new Jmol.Console.Output(console); +// check to see if the user already has a div on the page with id such as "jmolApplet0_console" +var userConsole = Jmol.$("#" + id); +// set up this.appletConsole.input, this.appletconsole.output +// set up buttons, which are already made by this time: +// I would prefer NOT to use jQueryUI for this - just simple buttons with simple actions +// create and insert HTML code +var s = '' +var w = 600, h = 362; +if (userConsole[0]) { +var dims = Jmol.$getSize(userConsole); +if (dims[0] == 0) +Jmol.$setSize(userConsole, w, h); +w = dims[0] || w; +h = dims[1] || h; +} else { +s = '
close " + obj.title + " [" + canvas.width + " x " + canvas.height + "] ' + s + ''; +} +Jmol.Console.createDOM(this, s, userConsole); +var setBtn = function(console, btn) { +btn.console = console; +btn.id = id + "_" + btn.label.replace(/\s/g,"_"); +Jmol.Console.buttons[btn.id] = btn; +return btn.html(); +} +s = setBtn(console, appletConsole.runButton) ++ setBtn(console, appletConsole.loadButton) ++ setBtn(console, appletConsole.clearInButton) ++ setBtn(console, appletConsole.clearOutButton) ++ setBtn(console, appletConsole.historyButton) ++ setBtn(console, appletConsole.stateButton); +Jmol.$html(id + "_buttondiv", s); +s = ""; +if (!userConsole[0]) +s += " close"; +s += " help"; +Jmol.$html(id + "_label1", s); +if (userConsole[0]) { +// leaves a little slop for margins +w = w - 10; +h = (h - Jmol.$getSize(id + "_label1")[1] - Jmol.$getSize(id + "_buttondiv")[1] - 20)/3; +} else { +w = w - 10; +h = (h - 62)/3; +} +Jmol.$html(id + "_inputdiv", ''); +Jmol.$html(id + "_outputdiv", ''); +Jmol.Cache.setDragDrop(this.applet, "console_output"); +Jmol.Cache.setDragDrop(this.applet, "console_input"); +Jmol.$bind("#" + id + "_input", "keydown keypress keyup", function(event) { console.input.keyEvent(event) }); +Jmol.$bind("#" + id + "_input", "mousedown touchstart", function(event) { console.ignoreMouse=true }); +Jmol.$bind("#" + id + "_output", "mousedown touchstart", function(event) { console.ignoreMouse=true }); +console.setButton = function(text) { +return new Jmol.Console.Button(this, text); +} +console.setVisible = function(b) { +if (b) +this.container.show(); +else +this.container.hide(); +this.dragBind(b); +} +console.setTitle = function(title) { +//Jmol.$html(this.id + "_title", title); +} +console.setVisible(false); +} +Jmol.Swing.setDraggable(Jmol.Console.JSConsole); +Jmol.Console.Input = function(console) { +this.console = console; +this.id = console.id + "_input"; +// something like this.... +this.getText = function() { +return Jmol.$val(this.id); +} +this.setText = function(text) { +if (text == null) +text = ""; +Jmol.$val(this.id, text); +} +this.keyEvent = function(ev) { +// chrome/safari +// for left paren: +// keyCode which key originalEvent.keyIdentifier +// keydown 57 57 - U+0039 +// keypress 40 40 - Down // why Down?? +// +// for down arrow +// keydown 40 40 - Down +// ff, msie +// for left paren: +// keyCode which key originalEvent.keyIdentifier +// keydown 57 57 ( - +// keypress 0 40 ( - +// +// for down arrow +// keydown 40 40 Down - +// in all cases: normal keys (as well as backspace[8] and delete[46]) are keydown keypress keyup +// special keys just keydown keyup +// keyup is only once when repeated; same as keydown +// ff/msie delivers key, chrome/safari does not +// chrome/safari has "feature" that keyIdentifier for "(" is reported as "Down" and similar issues for many other keys +//System.out.println(ev.type + " key:" + (!ev.key) + " keyCode:" + ev.keyCode + " which:" + ev.which + " " + ev.key + "--" + ev.originalEvent.keyIdentifier); +var mode; +var type = ev.type; +var isCtrl = ev.ctrlKey; +var kcode = ev.keyCode; +if (kcode == 13) +kcode=10; +// keycode is deprecated, but is essential still +if (type == "keyup") { +mode = (kcode == 38 || kcode == 40 ? 1 : this.console.appletConsole.processKey(kcode, 402, isCtrl)); +if ((mode & 1) == 1) +ev.preventDefault(); +return; +} +// includes keypress and keydown +// only assign "key" for keydown, as keypress gives erroneous identifier in chrome/safari +var isKeydown = (type == "keydown"); +var key = (isKeydown ? (ev.key || ev.originalEvent.keyIdentifier) : ""); +switch (kcode) { +case 38: // up-arrow, possibly +case 40: // down-arrow, possibly +// must be keydown, not keypress to be arrow key +if (!isKeydown) +kcode = 0; +break; +case 8: // bs +case 9: // tab +case 10: // CR +case 27: // esc +// only these are of interest to Jmol +break; +default: +kcode = 0; // nothing to report +} +mode = this.console.appletConsole.processKey(kcode, 401, isCtrl); +if (isCtrl && kcode == 10) +this.setText(this.getText() + "\n") +if (mode == 0 && ev.keyCode == 9) { +var me = this; +setTimeout(function(){me.setText(me.getText() + "\t"); Jmol.$focus(me.id)},10); +} +// ignore if... +if ((mode & 1) == 1 // Jmol has handled the key press +|| key == "Up" || key == "Down" // up and down arrows +|| isKeydown && ev.keyCode != 8 && ev.keyCode < 32 // a special character other than backspace, when keyDown +) { +ev.preventDefault(); +} +} +this.getCaretPosition = function() { +var el = Jmol._$(this.id)[0]; +if('selectionStart' in el) +return el.selectionStart; +if(!('selection' in document)) +return 0; +el.focus(); +var sel = document.selection.createRange(); +var len = document.selection.createRange().text.length; +sel.moveStart('character', -el.value.length); +return sel.text.length - len; +} +} +Jmol.Console.Output = function(console) { +this.id = console.id + "_output"; +this.getText = function() { +return Jmol.$val(this.id); +} +this.setText = function(text) { +if (text == null) +text = ""; +Jmol.$val(this.id, text); +} +this.append = function(message, att) { +this.setText(this.getText() + message); +Jmol.$scrollTo(this.id, -1); +} +} +Jmol.Console.Button = function(text) { +this.label = text; +} +Jmol.Console.Button.prototype.addConsoleListener = function(appletConsole) { +this.appletConsole = appletConsole; +Jmol.Console.buttons[this.id] = this; +} +Jmol.Console.Button.prototype.html = function() { +var s = '' +return s; +} +; +}}}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/consolejs/JSConsole.js b/config/plugins/visualizations/jmol/static/j2s/J/consolejs/JSConsole.js new file mode 100755 index 000000000000..8ae96bafc80f --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/consolejs/JSConsole.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.consolejs"); +Clazz.declareInterface(J.consolejs, "JSConsole"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/dialog/Dialog.js b/config/plugins/visualizations/jmol/static/j2s/J/dialog/Dialog.js new file mode 100755 index 000000000000..b3e40aabdbb1 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/dialog/Dialog.js @@ -0,0 +1,415 @@ +Clazz.declarePackage("J.dialog"); +Clazz.load(["javax.swing.JPanel", "javax.swing.event.ChangeListener", "javax.swing.filechooser.FileFilter", "J.api.JmolDialogInterface"], "J.dialog.Dialog", ["java.io.File", "javax.swing.JComboBox", "$.JFileChooser", "$.JOptionPane", "$.JSlider", "$.SwingUtilities", "$.UIManager", "javax.swing.border.TitledBorder", "J.dialog.FileChooser", "$.FilePreview", "J.i18n.GT", "JU.Logger", "JV.FileManager"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.extensions = null; +this.choice = null; +this.extension = null; +this.qSliderJPEG = null; +this.qSliderPNG = null; +this.cb = null; +this.qPanelJPEG = null; +this.qPanelPNG = null; +this.openPreview = null; +this.initialFile = null; +if (!Clazz.isClassDefined("J.dialog.Dialog.QualityListener")) { +J.dialog.Dialog.$Dialog$QualityListener$ (); +} +if (!Clazz.isClassDefined("J.dialog.Dialog.ExportChoiceListener")) { +J.dialog.Dialog.$Dialog$ExportChoiceListener$ (); +} +this.imageChoices = null; +this.imageExtensions = null; +this.outputFileName = null; +this.dialogType = null; +this.inputFileName = null; +this.vwr = null; +this.qualityJ = -1; +this.qualityP = -1; +this.imageType = null; +Clazz.instantialize(this, arguments);}, J.dialog, "Dialog", javax.swing.JPanel, J.api.JmolDialogInterface); +Clazz.prepareFields (c$, function(){ +this.extensions = new Array(10); +this.imageChoices = Clazz.newArray(-1, ["JPEG", "PNG", "GIF", "PPM"]); +this.imageExtensions = Clazz.newArray(-1, ["jpg", "png", "gif", "ppm"]); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.dialog.Dialog, []); +}); +Clazz.overrideMethod(c$, "getOpenFileNameFromDialog", +function(vwrOptions, vwr, fileName, jmolApp, windowName, allowAppend){ +if (J.dialog.Dialog.openChooser == null) { +J.dialog.Dialog.openChooser = new J.dialog.FileChooser(); +var temp = javax.swing.UIManager.get("FileChooser.fileNameLabelText"); +javax.swing.UIManager.put("FileChooser.fileNameLabelText", J.i18n.GT.$("File or URL:")); +J.dialog.Dialog.getXPlatformLook(J.dialog.Dialog.openChooser); +javax.swing.UIManager.put("FileChooser.fileNameLabelText", temp); +}if (this.openPreview == null && (vwr.isApplet || Boolean.$valueOf(System.getProperty("openFilePreview", "true")).booleanValue())) { +this.openPreview = new J.dialog.FilePreview(vwr, J.dialog.Dialog.openChooser, allowAppend, vwrOptions); +}if (jmolApp != null) { +var dim = jmolApp.getHistoryWindowSize(windowName); +if (dim != null) J.dialog.Dialog.openChooser.setDialogSize(dim); +var loc = jmolApp.getHistoryWindowPosition(windowName); +if (loc != null) J.dialog.Dialog.openChooser.setDialogLocation(loc); +}J.dialog.Dialog.openChooser.resetChoosableFileFilters(); +if (this.openPreview != null) this.openPreview.setPreviewOptions(allowAppend); +if (fileName != null) { +var pt = fileName.lastIndexOf("."); +var sType = fileName.substring(pt + 1); +if (pt >= 0 && sType.length > 0) J.dialog.Dialog.openChooser.addChoosableFileFilter( new J.dialog.Dialog.TypeFilter(sType)); +if (fileName.indexOf(".") == 0) fileName = "Jmol" + fileName; +if (fileName.length > 0) J.dialog.Dialog.openChooser.setSelectedFile( new java.io.File(fileName)); +}if (fileName == null || fileName.indexOf(":") < 0 && fileName.indexOf("/") != 0) { +var dir = JV.FileManager.getLocalDirectory(vwr, true); +J.dialog.Dialog.openChooser.setCurrentDirectory(dir); +}var file = null; +if (J.dialog.Dialog.openChooser.showOpenDialog(this) == 0) file = J.dialog.Dialog.openChooser.getSelectedFile(); +if (file == null) return this.closePreview(); +if (jmolApp != null) jmolApp.addHistoryWindowInfo(windowName, J.dialog.Dialog.openChooser.getDialog(), null); +var url = vwr.getLocalUrl(file.getAbsolutePath()); +if (url != null) { +fileName = url; +} else { +JV.FileManager.setLocalPath(vwr, file.getParent(), true); +fileName = file.getAbsolutePath(); +}if (fileName.startsWith("/")) fileName = "file://" + fileName; +var doCartoons = (jmolApp == null || allowAppend && this.openPreview != null && this.openPreview.isCartoonsSelected()); +var doAppend = (allowAppend && !JV.FileManager.isScriptType(fileName) && this.openPreview != null && this.openPreview.isAppendSelected()); +this.closePreview(); +return (doCartoons ? "" : "#NOCARTOONS#;") + (doAppend ? "#APPEND#;" : "") + fileName; +}, "java.util.Map,JV.Viewer,~S,J.api.JmolAppAPI,~S,~B"); +Clazz.defineMethod(c$, "closePreview", +function(){ +if (this.openPreview != null) this.openPreview.doUpdatePreview(null); +return null; +}); +Clazz.overrideMethod(c$, "getSaveFileNameFromDialog", +function(vwr, fileName, type){ +if (J.dialog.Dialog.saveChooser == null) { +J.dialog.Dialog.saveChooser = new javax.swing.JFileChooser(); +J.dialog.Dialog.getXPlatformLook(J.dialog.Dialog.saveChooser); +}J.dialog.Dialog.saveChooser.setCurrentDirectory(JV.FileManager.getLocalDirectory(vwr, true)); +var file = null; +J.dialog.Dialog.saveChooser.resetChoosableFileFilters(); +if (fileName != null) { +var pt = fileName.lastIndexOf("."); +var sType = fileName.substring(pt + 1); +if (pt >= 0 && sType.length > 0) J.dialog.Dialog.saveChooser.addChoosableFileFilter( new J.dialog.Dialog.TypeFilter(sType)); +if (fileName.equals("*")) fileName = vwr.getModelSetFileName(); +if (fileName.indexOf(".") == 0) fileName = "Jmol" + fileName; +file = new java.io.File(fileName); +}if (type != null) J.dialog.Dialog.saveChooser.addChoosableFileFilter( new J.dialog.Dialog.TypeFilter(type)); +J.dialog.Dialog.saveChooser.setSelectedFile(file); +if ((file = this.showSaveDialog(this, J.dialog.Dialog.saveChooser, file)) == null) return null; +JV.FileManager.setLocalPath(vwr, file.getParent(), true); +return file.getAbsolutePath(); +}, "JV.Viewer,~S,~S"); +Clazz.overrideMethod(c$, "getImageFileNameFromDialog", +function(vwr, fileName, type, imageChoices, imageExtensions, qualityJPG0, qualityPNG0){ +if (qualityJPG0 < 0 || qualityJPG0 > 100) qualityJPG0 = J.dialog.Dialog.qualityJPG; +if (qualityPNG0 < 0) qualityPNG0 = J.dialog.Dialog.qualityPNG; +if (qualityPNG0 > 9) qualityPNG0 = 2; +J.dialog.Dialog.qualityJPG = qualityJPG0; +J.dialog.Dialog.qualityPNG = qualityPNG0; +if (this.extension == null) this.extension = "jpg"; +if (J.dialog.Dialog.imageChooser == null) { +J.dialog.Dialog.imageChooser = new javax.swing.JFileChooser(); +J.dialog.Dialog.getXPlatformLook(J.dialog.Dialog.imageChooser); +}J.dialog.Dialog.imageChooser.setCurrentDirectory(JV.FileManager.getLocalDirectory(vwr, true)); +J.dialog.Dialog.imageChooser.resetChoosableFileFilters(); +var file = null; +if (fileName == null) { +fileName = vwr.getModelSetFileName(); +if (fileName.indexOf("?") >= 0) fileName = fileName.substring(0, fileName.indexOf("?")); +var pathName = J.dialog.Dialog.imageChooser.getCurrentDirectory().getPath(); +if (fileName != null && pathName != null) { +var extensionStart = fileName.lastIndexOf('.'); +if (extensionStart != -1) { +fileName = fileName.substring(0, extensionStart) + "." + this.extension; +}file = new java.io.File(pathName, fileName); +}} else { +if (fileName.indexOf(".") == 0) fileName = "Jmol" + fileName; +file = new java.io.File(fileName); +type = fileName.substring(fileName.lastIndexOf(".") + 1); +for (var i = 0; i < imageExtensions.length; i++) if (type.equals(imageChoices[i]) || type.toLowerCase().equals(imageExtensions[i])) { +type = imageChoices[i]; +break; +} +}this.createExportPanel(imageChoices, imageExtensions, type); +J.dialog.Dialog.imageChooser.setSelectedFile(this.initialFile = file); +if ((file = this.showSaveDialog(this, J.dialog.Dialog.imageChooser, file)) == null) return null; +J.dialog.Dialog.qualityJPG = this.qSliderJPEG.getValue(); +J.dialog.Dialog.qualityPNG = this.qSliderPNG.getValue(); +if (this.cb.getSelectedIndex() >= 0) J.dialog.Dialog.defaultChoice = this.cb.getSelectedIndex(); +JV.FileManager.setLocalPath(vwr, file.getParent(), true); +return file.getAbsolutePath(); +}, "JV.Viewer,~S,~S,~A,~A,~N,~N"); +Clazz.defineMethod(c$, "createExportPanel", +function(choices, extensions, type){ +J.dialog.Dialog.imageChooser.setAccessory(this); +this.setLayout( new java.awt.BorderLayout()); +if (type == null || type.equals("JPG")) type = "JPEG"; +for (J.dialog.Dialog.defaultChoice = choices.length; --J.dialog.Dialog.defaultChoice >= 1; ) if (choices[J.dialog.Dialog.defaultChoice].equals(type)) break; + +this.extension = extensions[J.dialog.Dialog.defaultChoice]; +this.choice = choices[J.dialog.Dialog.defaultChoice]; +this.extensions = extensions; +J.dialog.Dialog.imageChooser.resetChoosableFileFilters(); +J.dialog.Dialog.imageChooser.addChoosableFileFilter( new J.dialog.Dialog.TypeFilter(this.extension)); +var cbPanel = new javax.swing.JPanel(); +cbPanel.setLayout( new java.awt.FlowLayout()); +cbPanel.setBorder( new javax.swing.border.TitledBorder(J.i18n.GT.$("Image Type"))); +this.cb = new javax.swing.JComboBox(); +for (var i = 0; i < choices.length; i++) { +this.cb.addItem(choices[i]); +} +cbPanel.add(this.cb); +this.cb.setSelectedIndex(J.dialog.Dialog.defaultChoice); +this.cb.addItemListener(Clazz.innerTypeInstance(J.dialog.Dialog.ExportChoiceListener, this, null)); +this.add(cbPanel, "North"); +var qPanel2 = new javax.swing.JPanel(); +qPanel2.setLayout( new java.awt.BorderLayout()); +this.qPanelJPEG = new javax.swing.JPanel(); +this.qPanelJPEG.setLayout( new java.awt.BorderLayout()); +this.qPanelJPEG.setBorder( new javax.swing.border.TitledBorder(J.i18n.GT.i(J.i18n.GT.$("JPEG Quality ({0})"), J.dialog.Dialog.qualityJPG))); +this.qSliderJPEG = new javax.swing.JSlider(0, 50, 100, J.dialog.Dialog.qualityJPG); +this.qSliderJPEG.putClientProperty("JSlider.isFilled", Boolean.TRUE); +this.qSliderJPEG.setPaintTicks(true); +this.qSliderJPEG.setMajorTickSpacing(10); +this.qSliderJPEG.setPaintLabels(true); +this.qSliderJPEG.addChangeListener(Clazz.innerTypeInstance(J.dialog.Dialog.QualityListener, this, null, true, this.qSliderJPEG)); +this.qPanelJPEG.add(this.qSliderJPEG, "South"); +qPanel2.add(this.qPanelJPEG, "North"); +this.qPanelPNG = new javax.swing.JPanel(); +this.qPanelPNG.setLayout( new java.awt.BorderLayout()); +this.qPanelPNG.setBorder( new javax.swing.border.TitledBorder(J.i18n.GT.i(J.i18n.GT.$("PNG Compression ({0})"), J.dialog.Dialog.qualityPNG))); +this.qSliderPNG = new javax.swing.JSlider(0, 0, 9, J.dialog.Dialog.qualityPNG); +this.qSliderPNG.putClientProperty("JSlider.isFilled", Boolean.TRUE); +this.qSliderPNG.setPaintTicks(true); +this.qSliderPNG.setMajorTickSpacing(2); +this.qSliderPNG.setPaintLabels(true); +this.qSliderPNG.addChangeListener(Clazz.innerTypeInstance(J.dialog.Dialog.QualityListener, this, null, false, this.qSliderPNG)); +this.qPanelPNG.add(this.qSliderPNG, "South"); +qPanel2.add(this.qPanelPNG, "South"); +this.add(qPanel2, "South"); +}, "~A,~A,~S"); +Clazz.overrideMethod(c$, "getType", +function(){ +return this.choice; +}); +Clazz.overrideMethod(c$, "getQuality", +function(sType){ +return (sType.equals("JPEG") || sType.equals("JPG") ? J.dialog.Dialog.qualityJPG : sType.equals("PNG") ? J.dialog.Dialog.qualityPNG : -1); +}, "~S"); +c$.doOverWrite = Clazz.defineMethod(c$, "doOverWrite", +function(chooser, file){ +var options = Clazz.newArray(-1, [J.i18n.GT.$("Yes"), J.i18n.GT.$("No")]); +var opt = javax.swing.JOptionPane.showOptionDialog(chooser, J.i18n.GT.o(J.i18n.GT.$("Do you want to overwrite file {0}?"), file.getAbsolutePath()), J.i18n.GT.$("Warning"), -1, 2, null, options, options[0]); +return (opt == 0); +}, "javax.swing.JFileChooser,java.io.File"); +Clazz.defineMethod(c$, "showSaveDialog", +function(c, chooser, file){ +while (true) { +if (chooser.showSaveDialog(c) != 0) return null; +if (this.cb != null && this.cb.getSelectedIndex() >= 0) J.dialog.Dialog.defaultChoice = this.cb.getSelectedIndex(); +if ((file = chooser.getSelectedFile()) == null || !file.exists() || J.dialog.Dialog.doOverWrite(chooser, file)) return file; +} +}, "java.awt.Component,javax.swing.JFileChooser,java.io.File"); +Clazz.overrideMethod(c$, "setupUI", +function(forceNewTranslation){ +if (forceNewTranslation || !J.dialog.Dialog.haveTranslations) J.dialog.Dialog.setupUIManager(); +J.dialog.Dialog.haveTranslations = true; +}, "~B"); +c$.setupUIManager = Clazz.defineMethod(c$, "setupUIManager", +function(){ +javax.swing.UIManager.put("FileChooser.acceptAllFileFilterText", J.i18n.GT.$("All Files")); +javax.swing.UIManager.put("FileChooser.cancelButtonText", J.i18n.GT.$("Cancel")); +javax.swing.UIManager.put("FileChooser.cancelButtonToolTipText", J.i18n.GT.$("Abort file chooser dialog")); +javax.swing.UIManager.put("FileChooser.detailsViewButtonAccessibleName", J.i18n.GT.$("Details")); +javax.swing.UIManager.put("FileChooser.detailsViewButtonToolTipText", J.i18n.GT.$("Details")); +javax.swing.UIManager.put("FileChooser.directoryDescriptionText", J.i18n.GT.$("Directory")); +javax.swing.UIManager.put("FileChooser.directoryOpenButtonText", J.i18n.GT.$("Open")); +javax.swing.UIManager.put("FileChooser.directoryOpenButtonToolTipText", J.i18n.GT.$("Open selected directory")); +javax.swing.UIManager.put("FileChooser.fileAttrHeaderText", J.i18n.GT.$("Attributes")); +javax.swing.UIManager.put("FileChooser.fileDateHeaderText", J.i18n.GT.$("Modified")); +javax.swing.UIManager.put("FileChooser.fileDescriptionText", J.i18n.GT.$("Generic File")); +javax.swing.UIManager.put("FileChooser.fileNameHeaderText", J.i18n.GT.$("Name")); +javax.swing.UIManager.put("FileChooser.fileNameLabelText", J.i18n.GT.$("File Name:")); +javax.swing.UIManager.put("FileChooser.fileSizeHeaderText", J.i18n.GT.$("Size")); +javax.swing.UIManager.put("FileChooser.filesOfTypeLabelText", J.i18n.GT.$("Files of Type:")); +javax.swing.UIManager.put("FileChooser.fileTypeHeaderText", J.i18n.GT.$("Type")); +javax.swing.UIManager.put("FileChooser.helpButtonText", J.i18n.GT.$("Help")); +javax.swing.UIManager.put("FileChooser.helpButtonToolTipText", J.i18n.GT.$("FileChooser help")); +javax.swing.UIManager.put("FileChooser.homeFolderAccessibleName", J.i18n.GT.$("Home")); +javax.swing.UIManager.put("FileChooser.homeFolderToolTipText", J.i18n.GT.$("Home")); +javax.swing.UIManager.put("FileChooser.listViewButtonAccessibleName", J.i18n.GT.$("List")); +javax.swing.UIManager.put("FileChooser.listViewButtonToolTipText", J.i18n.GT.$("List")); +javax.swing.UIManager.put("FileChooser.lookInLabelText", J.i18n.GT.$("Look In:")); +javax.swing.UIManager.put("FileChooser.newFolderErrorText", J.i18n.GT.$("Error creating new folder")); +javax.swing.UIManager.put("FileChooser.newFolderAccessibleName", J.i18n.GT.$("New Folder")); +javax.swing.UIManager.put("FileChooser.newFolderToolTipText", J.i18n.GT.$("Create New Folder")); +javax.swing.UIManager.put("FileChooser.openButtonText", J.i18n.GT.$("Open")); +javax.swing.UIManager.put("FileChooser.openButtonToolTipText", J.i18n.GT.$("Open selected file")); +javax.swing.UIManager.put("FileChooser.openDialogTitleText", J.i18n.GT.$("Open")); +javax.swing.UIManager.put("FileChooser.saveButtonText", J.i18n.GT.$("Save")); +javax.swing.UIManager.put("FileChooser.saveButtonToolTipText", J.i18n.GT.$("Save selected file")); +javax.swing.UIManager.put("FileChooser.saveDialogTitleText", J.i18n.GT.$("Save")); +javax.swing.UIManager.put("FileChooser.saveInLabelText", J.i18n.GT.$("Save In:")); +javax.swing.UIManager.put("FileChooser.updateButtonText", J.i18n.GT.$("Update")); +javax.swing.UIManager.put("FileChooser.updateButtonToolTipText", J.i18n.GT.$("Update directory listing")); +javax.swing.UIManager.put("FileChooser.upFolderAccessibleName", J.i18n.GT.$("Up")); +javax.swing.UIManager.put("FileChooser.upFolderToolTipText", J.i18n.GT.$("Up One Level")); +javax.swing.UIManager.put("OptionPane.cancelButtonText", J.i18n.GT.$("Cancel")); +javax.swing.UIManager.put("OptionPane.noButtonText", J.i18n.GT.$("No")); +javax.swing.UIManager.put("OptionPane.okButtonText", J.i18n.GT.$("OK")); +javax.swing.UIManager.put("OptionPane.yesButtonText", J.i18n.GT.$("Yes")); +}); +c$.getXPlatformLook = Clazz.defineMethod(c$, "getXPlatformLook", +function(fc){ +if (J.dialog.Dialog.isMac) { +var lnf = javax.swing.UIManager.getLookAndFeel(); +if (lnf.isNativeLookAndFeel()) { +try { +javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getCrossPlatformLookAndFeelClassName()); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +System.out.println(e.getMessage()); +} else { +throw e; +} +} +fc.updateUI(); +try { +javax.swing.UIManager.setLookAndFeel(lnf); +} catch (e) { +if (Clazz.exceptionOf(e,"javax.swing.UnsupportedLookAndFeelException")){ +System.out.println(e.getMessage()); +} else { +throw e; +} +} +}} else { +fc.updateUI(); +}}, "javax.swing.JFileChooser"); +Clazz.overrideMethod(c$, "setImageInfo", +function(qualityJPG, qualityPNG, imageType){ +this.qualityJ = qualityJPG; +this.qualityP = qualityPNG; +this.imageType = imageType; +}, "~N,~N,~S"); +Clazz.overrideMethod(c$, "getFileNameFromDialog", +function(v, dType, iFileName){ +this.vwr = v; +this.dialogType = dType; +this.inputFileName = iFileName; +this.outputFileName = null; +try { +javax.swing.SwingUtilities.invokeAndWait(((Clazz.isClassDefined("J.dialog.Dialog$1") ? 0 : J.dialog.Dialog.$Dialog$1$ ()), Clazz.innerTypeInstance(J.dialog.Dialog$1, this, null))); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.error(e.getMessage()); +} else { +throw e; +} +} +return this.outputFileName; +}, "JV.Viewer,~S,~S"); +c$.$Dialog$QualityListener$ = function(){ +/*if4*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +Clazz.prepareCallback(this, arguments); +this.isJPEG = false; +this.slider = null; +Clazz.instantialize(this, arguments);}, J.dialog.Dialog, "QualityListener", null, javax.swing.event.ChangeListener); +Clazz.makeConstructor(c$, +function(isJPEG, slider){ +this.isJPEG = isJPEG; +this.slider = slider; +}, "~B,javax.swing.JSlider"); +Clazz.overrideMethod(c$, "stateChanged", +function(arg0){ +var value = this.slider.getValue(); +if (this.isJPEG) { +J.dialog.Dialog.qualityJPG = value; +this.b$["J.dialog.Dialog"].qPanelJPEG.setBorder( new javax.swing.border.TitledBorder(J.i18n.GT.i(J.i18n.GT.$("JPEG Quality ({0})"), value))); +} else { +J.dialog.Dialog.qualityPNG = value; +this.b$["J.dialog.Dialog"].qPanelPNG.setBorder( new javax.swing.border.TitledBorder(J.i18n.GT.i(J.i18n.GT.$("PNG Quality ({0})"), value))); +}}, "javax.swing.event.ChangeEvent"); +/*eoif4*/})(); +}; +c$.$Dialog$ExportChoiceListener$ = function(){ +/*if4*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +Clazz.prepareCallback(this, arguments); +Clazz.instantialize(this, arguments);}, J.dialog.Dialog, "ExportChoiceListener", null, java.awt.event.ItemListener); +Clazz.overrideMethod(c$, "itemStateChanged", +function(e){ +var source = e.getSource(); +var selectedFile = J.dialog.Dialog.imageChooser.getSelectedFile(); +if (selectedFile == null) selectedFile = this.b$["J.dialog.Dialog"].initialFile; +var newFile = null; +var name; +var newExt = this.b$["J.dialog.Dialog"].extensions[source.getSelectedIndex()]; +if ((name = selectedFile.getName()) != null && name.endsWith("." + this.b$["J.dialog.Dialog"].extension)) { +name = name.substring(0, name.length - this.b$["J.dialog.Dialog"].extension.length); +name += newExt; +this.b$["J.dialog.Dialog"].initialFile = newFile = new java.io.File(selectedFile.getParent(), name); +}this.b$["J.dialog.Dialog"].extension = newExt; +J.dialog.Dialog.imageChooser.resetChoosableFileFilters(); +J.dialog.Dialog.imageChooser.addChoosableFileFilter( new J.dialog.Dialog.TypeFilter(this.b$["J.dialog.Dialog"].extension)); +if (newFile != null) J.dialog.Dialog.imageChooser.setSelectedFile(newFile); +this.b$["J.dialog.Dialog"].choice = source.getSelectedItem(); +}, "java.awt.event.ItemEvent"); +/*eoif4*/})(); +}; +c$.$Dialog$1$=function(){ +/*if5*/;(function(){ +var c$ = Clazz.declareAnonymous(J.dialog, "Dialog$1", null, Runnable); +Clazz.overrideMethod(c$, "run", +function(){ +if (this.b$["J.dialog.Dialog"].dialogType.equals("Load")) { +this.b$["J.dialog.Dialog"].outputFileName = this.b$["J.dialog.Dialog"].getOpenFileNameFromDialog(this.b$["J.dialog.Dialog"].vwr.vwrOptions, this.b$["J.dialog.Dialog"].vwr, this.b$["J.dialog.Dialog"].inputFileName, null, null, false); +return; +}if (this.b$["J.dialog.Dialog"].dialogType.equals("Save")) { +this.b$["J.dialog.Dialog"].outputFileName = this.b$["J.dialog.Dialog"].getSaveFileNameFromDialog(this.b$["J.dialog.Dialog"].vwr, this.b$["J.dialog.Dialog"].inputFileName, null); +return; +}if (this.b$["J.dialog.Dialog"].dialogType.startsWith("Save Image")) { +this.b$["J.dialog.Dialog"].outputFileName = this.b$["J.dialog.Dialog"].getImageFileNameFromDialog(this.b$["J.dialog.Dialog"].vwr, this.b$["J.dialog.Dialog"].inputFileName, this.b$["J.dialog.Dialog"].imageType, this.b$["J.dialog.Dialog"].imageChoices, this.b$["J.dialog.Dialog"].imageExtensions, this.b$["J.dialog.Dialog"].qualityJ, this.b$["J.dialog.Dialog"].qualityP); +return; +}this.b$["J.dialog.Dialog"].outputFileName = null; +}); +/*eoif5*/})(); +}; +/*if3*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.thisType = null; +Clazz.instantialize(this, arguments);}, J.dialog.Dialog, "TypeFilter", javax.swing.filechooser.FileFilter); +Clazz.makeConstructor(c$, +function(type){ +Clazz.superConstructor (this, J.dialog.Dialog.TypeFilter, []); +this.thisType = type.toLowerCase(); +}, "~S"); +Clazz.overrideMethod(c$, "accept", +function(f){ +if (f.isDirectory() || this.thisType == null) { +return true; +}var ext = f.getName(); +var pt = ext.lastIndexOf("."); +return (pt >= 0 && ext.substring(pt + 1).toLowerCase().equals(this.thisType)); +}, "java.io.File"); +Clazz.overrideMethod(c$, "getDescription", +function(){ +return this.thisType.toUpperCase() + " (*." + this.thisType + ")"; +}); +/*eoif3*/})(); +c$.defaultChoice = 0; +c$.qualityJPG = 75; +c$.qualityPNG = 2; +c$.imageChooser = null; +c$.saveChooser = null; +c$.openChooser = null; +c$.haveTranslations = false; +c$.isMac = System.getProperty("os.name", "").startsWith("Mac"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/dialog/FileChooser.js b/config/plugins/visualizations/jmol/static/j2s/J/dialog/FileChooser.js new file mode 100755 index 000000000000..2a86d8be3ba0 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/dialog/FileChooser.js @@ -0,0 +1,31 @@ +Clazz.declarePackage("J.dialog"); +Clazz.load(["javax.swing.JFileChooser"], "J.dialog.FileChooser", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.dialogLocation = null; +this.dialogSize = null; +this.$dialog = null; +Clazz.instantialize(this, arguments);}, J.dialog, "FileChooser", javax.swing.JFileChooser); +Clazz.defineMethod(c$, "createDialog", +function(parent){ +this.$dialog = Clazz.superCall(this, J.dialog.FileChooser, "createDialog", [parent]); +if (this.$dialog != null) { +if (this.dialogLocation != null) { +this.$dialog.setLocation(this.dialogLocation); +}if (this.dialogSize != null) { +this.$dialog.setSize(this.dialogSize); +}}return this.$dialog; +}, "java.awt.Component"); +Clazz.defineMethod(c$, "setDialogLocation", +function(p){ +this.dialogLocation = p; +}, "java.awt.Point"); +Clazz.defineMethod(c$, "setDialogSize", +function(d){ +this.dialogSize = d; +}, "java.awt.Dimension"); +Clazz.defineMethod(c$, "getDialog", +function(){ +return this.$dialog; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/dialog/FilePreview.js b/config/plugins/visualizations/jmol/static/j2s/J/dialog/FilePreview.js new file mode 100755 index 000000000000..72f1fe9e38f4 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/dialog/FilePreview.js @@ -0,0 +1,125 @@ +Clazz.declarePackage("J.dialog"); +Clazz.load(["java.beans.PropertyChangeListener", "javax.swing.JPanel", ], "J.dialog.FilePreview", ["JU.PT", "javax.swing.Box", "$.JCheckBox", "J.i18n.GT", "JV.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.active = null; +this.append = null; +this.cartoons = null; +this.chooser = null; +this.display = null; +this.vwr = null; +Clazz.instantialize(this, arguments);}, J.dialog, "FilePreview", javax.swing.JPanel, java.beans.PropertyChangeListener); +Clazz.makeConstructor(c$, +function(vwr, fileChooser, allowAppend, vwrOptions){ +Clazz.superConstructor(this, J.dialog.FilePreview); +this.vwr = vwr; +this.chooser = fileChooser; +var box = javax.swing.Box.createVerticalBox(); +this.active = new javax.swing.JCheckBox(J.i18n.GT.$("Preview"), false); +this.active.addActionListener(((Clazz.isClassDefined("J.dialog.FilePreview$1") ? 0 : J.dialog.FilePreview.$FilePreview$1$ ()), Clazz.innerTypeInstance(J.dialog.FilePreview$1, this, null))); +box.add(this.active); +this.display = new J.dialog.FilePreview.FPPanel(vwrOptions); +this.display.setPreferredSize( new java.awt.Dimension(80, 80)); +this.display.setMinimumSize( new java.awt.Dimension(50, 50)); +box.add(this.display); +if (allowAppend) { +this.append = new javax.swing.JCheckBox(J.i18n.GT.$("Append models"), false); +box.add(this.append); +this.cartoons = new javax.swing.JCheckBox(J.i18n.GT.$("PDB cartoons"), J.dialog.FilePreview.pdbCartoonChecked); +this.cartoons.addActionListener(((Clazz.isClassDefined("J.dialog.FilePreview$2") ? 0 : J.dialog.FilePreview.$FilePreview$2$ ()), Clazz.innerTypeInstance(J.dialog.FilePreview$2, this, null))); +box.add(this.cartoons); +}this.add(box); +fileChooser.setAccessory(this); +fileChooser.addPropertyChangeListener(this); +}, "JV.Viewer,javax.swing.JFileChooser,~B,java.util.Map"); +Clazz.defineMethod(c$, "doPreviewAction", +function(selected){ +this.doUpdatePreview(selected ? this.chooser.getSelectedFile() : null); +}, "~B"); +Clazz.defineMethod(c$, "isAppendSelected", +function(){ +return (this.append != null && this.append.isSelected()); +}); +Clazz.defineMethod(c$, "isCartoonsSelected", +function(){ +return J.dialog.FilePreview.pdbCartoonChecked = (this.cartoons != null && this.cartoons.isSelected()); +}); +Clazz.overrideMethod(c$, "propertyChange", +function(evt){ +if (this.active.isSelected()) { +var prop = evt.getPropertyName(); +if ("SelectedFileChangedProperty".equals(prop)) { +this.doUpdatePreview(evt.getNewValue()); +}}}, "java.beans.PropertyChangeEvent"); +Clazz.defineMethod(c$, "doUpdatePreview", +function(file){ +var script; +if (file == null) { +script = "zap"; +} else { +var fileName = file.getAbsolutePath(); +var url = this.vwr.getLocalUrl(fileName); +if (url != null) fileName = url; +fileName = fileName.$replace('\\', '/'); +script = " \"" + fileName + "\""; +if (fileName.indexOf(".spt") >= 0) { +script = "script " + script; +} else { +script = JU.PT.rep(this.display.vwr.getP("defaultdropscript"), "\"%FILE\"", script + " 1"); +script = JU.PT.rep(script, "%ALLOWCARTOONS", "" + (this.isCartoonsSelected() && !this.isAppendSelected())); +System.out.println(script); +}}this.display.vwr.evalStringQuiet(script); +}, "java.io.File"); +Clazz.defineMethod(c$, "setPreviewOptions", +function(TF){ +if (this.append == null) return; +this.append.setVisible(TF); +this.cartoons.setVisible(TF); +}, "~B"); +c$.$FilePreview$1$=function(){ +/*if5*/;(function(){ +var c$ = Clazz.declareAnonymous(J.dialog, "FilePreview$1", null, java.awt.event.ActionListener); +Clazz.overrideMethod(c$, "actionPerformed", +function(e){ +this.b$["J.dialog.FilePreview"].doPreviewAction(this.b$["J.dialog.FilePreview"].active.isSelected()); +}, "java.awt.event.ActionEvent"); +/*eoif5*/})(); +}; +c$.$FilePreview$2$=function(){ +/*if5*/;(function(){ +var c$ = Clazz.declareAnonymous(J.dialog, "FilePreview$2", null, java.awt.event.ActionListener); +Clazz.overrideMethod(c$, "actionPerformed", +function(e){ +if (this.b$["J.dialog.FilePreview"].active.isSelected()) { +this.b$["J.dialog.FilePreview"].doUpdatePreview(this.b$["J.dialog.FilePreview"].chooser.getSelectedFile()); +}}, "java.awt.event.ActionEvent"); +/*eoif5*/})(); +}; +/*if3*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.vwr = null; +this.currentSize = null; +Clazz.instantialize(this, arguments);}, J.dialog.FilePreview, "FPPanel", javax.swing.JPanel); +Clazz.prepareFields (c$, function(){ +this.currentSize = new java.awt.Dimension(); +}); +Clazz.makeConstructor(c$, +function(info){ +Clazz.superConstructor (this, J.dialog.FilePreview.FPPanel, []); +info.put("previewOnly", Boolean.TRUE); +var display = info.get("display"); +info.put("display", this); +this.vwr = new JV.Viewer(info); +info.put("display", display); +}, "java.util.Map"); +Clazz.overrideMethod(c$, "paint", +function(g){ +this.getSize(this.currentSize); +this.vwr.setScreenDimension(this.currentSize.width, this.currentSize.height); +var rectClip = new java.awt.Rectangle(); +g.getClipBounds(rectClip); +this.vwr.renderScreenImage(g, this.currentSize.width, this.currentSize.height); +}, "java.awt.Graphics"); +/*eoif3*/})(); +c$.pdbCartoonChecked = true; +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/dssx/AnnotationParser.js b/config/plugins/visualizations/jmol/static/j2s/J/dssx/AnnotationParser.js new file mode 100755 index 000000000000..8c4e5414c9f4 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/dssx/AnnotationParser.js @@ -0,0 +1,429 @@ +Clazz.declarePackage("J.dssx"); +Clazz.load(["J.api.JmolAnnotationParser"], "J.dssx.AnnotationParser", ["java.util.Hashtable", "JU.AU", "$.BS", "$.Lst", "$.PT", "$.SB", "JM.Group", "JM.BioResolver", "JS.SV", "JU.BSUtil", "$.Logger"], function(){ +var c$ = Clazz.declareType(J.dssx, "AnnotationParser", null, J.api.JmolAnnotationParser); +/*LV!1824 unnec constructor*/Clazz.defineMethod(c$, "getAnnotationKVPairs", +function(a, match, dotPath, sb, pre, showDetail, isMappingOnly, type){ +var map = a.getMap(); +if (map == null || map.isEmpty()) return; +if (map.containsKey("_map")) map = map.get("_map").getMap(); +var detailKey = this.getDataKey(type); +if (showDetail && map.containsKey(detailKey)) { +if (match == null || dotPath.indexOf(match) >= 0) sb.append(map.get(detailKey).asString()).append("\n"); +return; +}for (var e, $e = map.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) { +var key = e.getKey(); +if (key.equals(detailKey)) continue; +if (key.equals("metadata")) sb.append("\n"); +var val = e.getValue(); +if (val.tok == 6) { +if (type == 1073742189 && !showDetail) { +sb.append(key).append("\n"); +} else { +this.getAnnotationKVPairs(val, match, (dotPath.length == 0 ? "" : dotPath + ".") + key, sb, (pre.length == 0 ? "" : pre + "\t") + key, showDetail, isMappingOnly, type); +}} else { +var s = val.asString(); +if (match == null || s.indexOf(match) >= 0 || pre.indexOf(match) >= 0 || key.indexOf(match) >= 0 || dotPath.indexOf(match) >= 0) { +if (showDetail && isMappingOnly) continue; +if (pre.length > 0) sb.append(pre).append("\t"); +sb.append(key).append("="); +sb.append(s).append("\n"); +}}} +}, "JS.SV,~S,~S,JU.SB,~S,~B,~B,~N"); +Clazz.defineMethod(c$, "getDataKey", +function(type){ +switch (type) { +case 1073741925: +return "mappings"; +case 1073742189: +return "outliers"; +} +return null; +}, "~N"); +Clazz.overrideMethod(c$, "catalogStructureUnits", +function(viewer, map0, modelAtomIndices, resMap, object, modelMap){ +var note = "Use within(rna3d, TYPE) where TYPE is one of: "; +var data = map0.getMap(); +if (data == null) return null; +try { +map0.mapPut("_map", JS.SV.newV(6, data)); +var list = new JU.Lst(); +var set = data.entrySet(); +var sv; +var map; +for (var e, $e = set.iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) { +sv = e.getValue(); +var structures = sv.getList(); +if (structures != null) { +var key = e.getKey(); +note += "\"" + key + "\" "; +var svPath = JS.SV.newS(key); +for (var j = structures.size(); --j >= 0; ) { +var struc = structures.get(j); +map = struc.getMap(); +sv = map.get("units"); +map.put("_isres", JS.SV.vT); +var units = (sv == null || sv.tok == 7 ? sv.getList() : sv.tok == 4 ? new JU.Lst() : null); +if (units != null) { +if (sv.tok == 4) { +var svl = JU.PT.split(sv.asString(), ","); +for (var i = svl.length; --i >= 0; ) units.addLast(JS.SV.newS(svl[i].trim())); + +}if (units.size() > 0) { +var bsAtoms = new JU.BS(); +map.put("_atoms", JS.SV.getVariable(bsAtoms)); +map.put("_path", svPath); +list.addLast(struc); +for (var k = units.size(); --k >= 0; ) { +this.catalogUnit(viewer, null, units.get(k).asString(), 0, bsAtoms, modelAtomIndices, resMap, null, modelMap); +} +}}} +}} +map0.mapPut("_list", JS.SV.newV(7, list)); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.info(e + " while cataloging structures"); +return null; +} else { +throw e; +} +} +return note; +}, "JV.Viewer,JS.SV,~A,java.util.Map,~O,java.util.Map"); +Clazz.overrideMethod(c$, "catalogValidations", +function(viewer, map0, modelAtomIndices, resMap, atomMap, modelMap){ +var data = map0.getMap(); +if (data == null) return null; +var retProperties = new JU.Lst(); +var nModels = modelAtomIndices.length - 1; +try { +data = this.getMainItem(data).getMap(); +map0.mapPut("_map", JS.SV.newV(6, data)); +var list = new JU.Lst(); +map0.mapPut("_list", JS.SV.newV(7, list)); +var set = data.entrySet(); +var sv; +var map; +for (var e, $e = set.iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) { +var floats = JU.AU.newFloat2(nModels); +for (var m = nModels; --m >= 0; ) floats[m] = Clazz.newFloatArray (modelAtomIndices[m + 1] - modelAtomIndices[m], 0); + +sv = e.getValue(); +var outliers = sv.getList(); +if (outliers == null) { +map = sv.getMap(); +if (map != null && (sv = map.get("outliers")) != null) outliers = sv.getList(); +}if (outliers != null) { +var hasUnit = false; +var key = e.getKey(); +var svPath = JS.SV.newS(key); +var isRes = false; +for (var j = outliers.size(); --j >= 0; ) { +var out = outliers.get(j); +map = out.getMap(); +sv = map.get("units"); +var svv = map.get("value"); +var val = (svv == null ? 1 : JS.SV.fValue(svv)); +var units = (val == 0 || sv == null || sv.tok == 7 ? sv.getList() : sv.tok == 4 ? new JU.Lst() : null); +if (units != null) { +if (sv.tok == 4) { +var svl = JU.PT.split(sv.asString(), ","); +for (var i = svl.length; --i >= 0; ) units.addLast(JS.SV.newS(svl[i].trim())); + +}if (units.size() > 0) { +var bsAtoms = new JU.BS(); +map.put("_atoms", JS.SV.getVariable(bsAtoms)); +map.put("_path", svPath); +hasUnit = true; +list.addLast(out); +for (var k = units.size(); --k >= 0; ) { +var ret = this.catalogUnit(viewer, floats, units.get(k).asString(), val, bsAtoms, modelAtomIndices, resMap, atomMap, modelMap); +if (ret) map.put("_isres", JS.SV.vT); +isRes = new Boolean (isRes | ret).valueOf(); +} +}}} +if (hasUnit) { +for (var m = nModels; --m >= 0; ) if (floats[m] != null) { +retProperties.addLast(key); +retProperties.addLast(floats[m]); +retProperties.addLast(Integer.$valueOf(m)); +retProperties.addLast(Boolean.$valueOf(isRes)); +} +}}} +return retProperties; +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.info(e + " while cataloging validations"); +return null; +} else { +throw e; +} +} +}, "JV.Viewer,JS.SV,~A,java.util.Map,java.util.Map,java.util.Map"); +Clazz.defineMethod(c$, "getMainItem", +function(data){ +for (var e, $e = data.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) { +var key = e.getKey(); +if (!key.contains("metadata")) return e.getValue(); +} +return null; +}, "java.util.Map"); +Clazz.overrideMethod(c$, "initializeAnnotation", +function(objAnn, type, modelIndex){ +var map = objAnn.getMap(); +var _list = map.get("_list"); +if (_list != null) return _list.getList(); +var dataKey = this.getDataKey(type); +var main = this.getMainItem(map); +map.put("_map", main); +var noSingles = true; +var _cat = new java.util.Hashtable(); +map.put("_cat", JS.SV.newV(6, _cat)); +var list = new JU.Lst(); +map.put("_list", _list = JS.SV.newV(7, list)); +for (var e, $e = main.getMap().entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) { +var _dbName = e.getKey(); +var _dbMap = e.getValue(); +_cat.putAll(_dbMap.getMap()); +for (var e2, $e2 = _dbMap.getMap().entrySet().iterator (); $e2.hasNext()&& ((e2 = $e2.next ()) || true);) { +var _domainName = e2.getKey(); +var _domainMap = e2.getValue(); +var _domainList = _domainMap.mapGet(dataKey); +var _mapList = _domainList.getList(); +for (var i = _mapList.size(); --i >= 0; ) { +var mapping = _mapList.get(i); +list.addLast(mapping); +var mmap = mapping.getMap(); +var _chain = mmap.get("chain_id"); +var start = mmap.get("start"); +var end = mmap.get("end"); +var res1 = 0; +var res2 = 0; +var rescode = "modelIndex=" + modelIndex + "&chain='" + _chain.value + "'"; +if (start != null && end != null) { +res1 = start.mapGet("residue_number").intValue; +res2 = end.mapGet("residue_number").intValue; +rescode += "&seqid>=" + res1 + "&seqid<=" + res2; +} else { +res2 = 1; +rescode += "&seqid>0"; +}var _atoms = (noSingles && res1 >= res2 ? JS.SV.getVariable( new JU.BS()) : _cat.get(rescode)); +if (_atoms == null) _cat.put(rescode, _atoms = JS.SV.newS(rescode)); +mmap.put("_atoms", _atoms); +mmap.put("_path", JS.SV.newS(_dbName + "." + _domainName)); +mmap.put("domain", _domainMap); +} +} +} +return list; +}, "JS.SV,~N,~N"); +Clazz.defineMethod(c$, "findAnnotationAtoms", +function(vwr, name, _list, key, bs){ +if (_list == null) return; +System.out.println("Checking " + name + " for " + key); +var data = vwr.extractProperty(_list, "[" + key + "]", -1); +var list = null; +if (Clazz.instanceOf(data,"JU.Lst")) { +list = data; +} else if (Clazz.instanceOf(data,"JS.SV")) { +list = (data).getList(); +}if (list == null) return; +for (var i = 0, n = list.size(); i < n; i++) { +var o = list.get(i); +var mapping = (Clazz.instanceOf(o,"JS.SV") ? (o).getMap() : o); +if (mapping == null) return; +bs.or(this.setAnnotationAtoms(vwr, mapping, i)); +} +}, "JV.Viewer,~S,JU.Lst,~S,JU.BS"); +Clazz.defineMethod(c$, "setAnnotationAtoms", +function(vwr, mapping, i){ +var _atoms = mapping.get("_atoms"); +if (_atoms.tok != 10) { +var bs2 = vwr.getAtomBitSet(_atoms.value); +if (i >= 0) JU.Logger.info("#" + (i + 1) + " found " + bs2.cardinality() + " atoms for " + _atoms.value); +_atoms.tok = 10; +_atoms.value = bs2; +}return _atoms.value; +}, "JV.Viewer,java.util.Map,~N"); +Clazz.defineMethod(c$, "catalogUnit", +function(viewer, vals, unitID, val, bsAtoms, modelAtomIndices, resMap, atomMap, modelMap){ +var s = JU.PT.split(unitID + (vals == null ? "||||" : "|||"), "|"); +if (s.length < 8 || s[1].length == 0 || s[2].length == 0 || s[3].length == 0 || s[4].length == 0) return false; +var sm = (s[1].length == 0 ? "1" : s[1]); +var m = (modelMap == null ? JU.PT.parseInt(sm) - 1 : -1); +var im = (m >= 0 ? null : modelMap.get(sm)); +if (im != null) m = im.intValue(); +if (m >= modelAtomIndices.length) return false; +var res = s[1] + "_" + viewer.getChainID(s[2], true) + "_" + s[4] + "_" + s[7].toLowerCase(); +var i0 = modelAtomIndices[m]; +var isRes = (atomMap == null || s[5].length == 0); +if (isRes) { +var a2 = resMap.get(res); +if (a2 != null) for (var j = a2[1], j0 = a2[0]; --j >= j0; ) { +bsAtoms.set(i0 + j); +if (vals != null) vals[m][j] += Math.abs(val); +} +} else { +if (s[5].charAt(0) == 'H') s[5] = this.getAttachedAtomForPDBH(s[3], s[5]); +var atom = res + "_" + s[5] + "_" + s[6].toLowerCase(); +var ia = atomMap.get(atom); +if (ia != null) { +var j = ia.intValue(); +bsAtoms.set(i0 + j); +if (vals != null) vals[m][j] += Math.abs(val); +}}return isRes; +}, "JV.Viewer,~A,~S,~N,JU.BS,~A,java.util.Map,java.util.Map,java.util.Map"); +Clazz.overrideMethod(c$, "getAtomBits", +function(vwr, key, dbObj, annotationCache, type, modelIndex, bsModel){ +if (dbObj == null) return new JU.BS(); +var doCache = !key.contains("NOCACHE"); +if (!doCache) { +key = JU.PT.rep(key, "NOCACHE", "").trim(); +}var bs = (doCache ? annotationCache.get(key) : null); +if (bs != null) return bs; +bs = new JU.BS(); +if (doCache) annotationCache.put(key, bs); +try { +var list = this.initializeAnnotation(dbObj, type, modelIndex); +var pt = key.toLowerCase().indexOf(" where "); +var path = JU.PT.rep((pt < 0 ? key : key.substring(0, pt)), " ", ""); +var newKey = (pt < 0 ? "" : key.substring(pt + 7).trim()); +if (path.indexOf(".") < 0) { +path = " _path like '" + path + "*'"; +} else { +path = " _path='" + path + "'"; +}newKey = "select * where " + (pt < 0 ? path : "(" + newKey + ") and (" + path + ")"); +JU.Logger.info("looking for " + newKey); +this.findAnnotationAtoms(vwr, path, list, newKey, bs); +bs.and(bsModel); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +System.out.println(e.toString() + " in AnnotationParser"); +bs.clearAll(); +} else { +throw e; +} +} +return bs; +}, "JV.Viewer,~S,~O,java.util.Map,~N,~N,JU.BS"); +Clazz.overrideMethod(c$, "getAtomValidation", +function(vwr, type, atom){ +var i = 0; +var n = 0; +var l = null; +var map = null; +var list = null; +try { +var ia = atom.i; +l = new JU.Lst(); +list = (vwr.ms.getModelAuxiliaryInfo(atom.mi).get("validation")).mapGet("_list").getList(); +for (i = 0, n = list.size(); i < n; i++) { +map = list.get(i).getMap(); +if (map.get("_path").value.equals(type) && (map.get("_atoms").value).get(ia)) { +var v = map.get("value"); +l.addLast(v.tok == 3 ? v.value : Float.$valueOf(v.asFloat())); +}} +return l; +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +return null; +} else { +throw e; +} +} +}, "JV.Viewer,~S,JM.Atom"); +Clazz.overrideMethod(c$, "getAnnotationInfo", +function(vwr, a, match, type, modelIndex){ +var sb = new JU.SB(); +if ("".equals(match)) match = null; +var isDetail = (match != null && (match.equals("all") || match.endsWith(" all"))); +if (isDetail) { +var _list = this.initializeAnnotation(a, type, modelIndex); +for (var i = _list.size(); --i >= 0; ) this.setAnnotationAtoms(vwr, _list.get(i).getMap(), -1); + +match = match.substring(0, Math.max(0, match.length - 4)).trim(); +}if ("".equals(match)) match = null; +if (type == 1073742189 && !isDetail && match == null) return a.mapGet("_note").asString(); +var isMappingOnly = (match != null && match.indexOf(".") >= 0 && match.indexOf(".*") < 0); +match = JU.PT.rep(match, "*", ""); +try { +this.getAnnotationKVPairs(a, match, "", sb, "", isDetail, isMappingOnly, type); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +{ +System.out.println(e); +}} else { +throw e; +} +} +return sb.toString(); +}, "JV.Viewer,JS.SV,~S,~N,~N"); +Clazz.defineMethod(c$, "getAttachedAtomForPDBH", +function(group3, name){ +if (name.charAt(0) == 'H') { +if (J.dssx.AnnotationParser.pdbAtomForH == null) { +J.dssx.AnnotationParser.pdbAtomForH = new java.util.Hashtable(); +this.assignPDBH("", "N H H1 H2 H3 CB HB2 HB3 CD HD2 HD3 CG HG2 HG3 C2' H2'' H2' C5' H5'' H5' OXT HXT"); +for (var i = JM.BioResolver.pdbBondInfo.length; --i >= 1; ) { +this.assignPDBH(JM.Group.group3Names[i], JM.BioResolver.pdbBondInfo[i]); +} +}var a = J.dssx.AnnotationParser.pdbAtomForH.get(name); +if (a == null) a = J.dssx.AnnotationParser.pdbAtomForH.get(group3 + name); +if (a != null) return a; +}return name; +}, "~S,~S"); +Clazz.defineMethod(c$, "assignPDBH", +function(group3, sNames){ +var names = JU.PT.getTokens(JU.PT.rep(sNames, "@", " ")); +var a = null; +for (var i = 0, n = names.length; i < n; i++) { +var s = names[i]; +if (s.charAt(0) != 'H') { +a = s; +continue; +}s = group3 + s; +if (s.indexOf("?") >= 0) { +s = s.substring(0, s.length - 1); +J.dssx.AnnotationParser.pdbAtomForH.put(s + "1", a); +J.dssx.AnnotationParser.pdbAtomForH.put(s + "2", a); +J.dssx.AnnotationParser.pdbAtomForH.put(s + "3", a); +} else { +J.dssx.AnnotationParser.pdbAtomForH.put(s, a); +}} +}, "~S,~S"); +Clazz.overrideMethod(c$, "fixAtoms", +function(modelIndex, dbObj, bsAddedMask, type, margin){ +var _list = this.initializeAnnotation(dbObj, type, modelIndex); +for (var i = _list.size(); --i >= 0; ) { +var m = _list.get(i).getMap(); +var _atoms = m.get("_atoms"); +if (_atoms != null && _atoms.tok == 10) JU.BSUtil.shiftBits(_atoms.value, bsAddedMask, _list.get(i).mapGet("_isres") != null, (_atoms.value).length() + margin); +} +}, "~N,JS.SV,JU.BS,~N,~N"); +Clazz.overrideMethod(c$, "getBasePairs", +function(vwr, modelIndex){ +}, "JV.Viewer,~N"); +Clazz.overrideMethod(c$, "calculateDSSRStructure", +function(vwr, bsAtoms){ +return null; +}, "JV.Viewer,JU.BS"); +Clazz.overrideMethod(c$, "fixDSSRJSONMap", +function(map){ +return null; +}, "java.util.Map"); +Clazz.overrideMethod(c$, "getHBonds", +function(ms, modelIndex, vHBonds, doReport){ +return null; +}, "JM.ModelSet,~N,JU.Lst,~B"); +Clazz.overrideMethod(c$, "getAtomicDSSRData", +function(ms, modelIndex, dssrData, dataType){ +}, "JM.ModelSet,~N,~A,~S"); +Clazz.overrideMethod(c$, "setGroup1", +function(ms, modelIndex){ +}, "JM.ModelSet,~N"); +Clazz.overrideMethod(c$, "getDSSRFrame", +function(dssrNT){ +return null; +}, "java.util.Map"); +c$.pdbAtomForH = null; +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/dssx/Bridge.js b/config/plugins/visualizations/jmol/static/j2s/J/dssx/Bridge.js new file mode 100755 index 000000000000..d19ea4a6edf0 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/dssx/Bridge.js @@ -0,0 +1,51 @@ +Clazz.declarePackage("J.dssx"); +Clazz.load(null, "J.dssx.Bridge", ["JU.Escape"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.a = null; +this.b = null; +this.ladder = null; +this.isAntiparallel = false; +Clazz.instantialize(this, arguments);}, J.dssx, "Bridge", null); +Clazz.makeConstructor(c$, +function(a, b, htLadders){ +this.a = a; +this.b = b; +this.ladder = Clazz.newIntArray (2, 2, 0); +this.ladder[0][0] = this.ladder[0][1] = Math.min(a.i, b.i); +this.ladder[1][0] = this.ladder[1][1] = Math.max(a.i, b.i); +this.addLadder(htLadders); +}, "JM.Atom,JM.Atom,java.util.Map"); +Clazz.defineMethod(c$, "addBridge", +function(bridge, htLadders){ +if (bridge.isAntiparallel != this.isAntiparallel || !this.canAdd(bridge) || !bridge.canAdd(this)) return false; +this.extendLadder(bridge.ladder[0][0], bridge.ladder[1][0]); +this.extendLadder(bridge.ladder[0][1], bridge.ladder[1][1]); +bridge.ladder = this.ladder; +if (bridge.ladder !== this.ladder) { +htLadders.remove(bridge.ladder); +this.addLadder(htLadders); +}return true; +}, "J.dssx.Bridge,java.util.Map"); +Clazz.defineMethod(c$, "addLadder", +function(htLadders){ +htLadders.put(this.ladder, (this.isAntiparallel ? Boolean.TRUE : Boolean.FALSE)); +}, "java.util.Map"); +Clazz.defineMethod(c$, "canAdd", +function(bridge){ +var index1 = bridge.a.i; +var index2 = bridge.b.i; +return (this.isAntiparallel ? (index1 >= this.ladder[0][1] && index2 <= this.ladder[1][0] || index1 <= this.ladder[0][0] && index2 >= this.ladder[1][1]) : (index1 <= this.ladder[0][0] && index2 <= this.ladder[1][0] || index1 >= this.ladder[0][1] && index2 >= this.ladder[1][1])); +}, "J.dssx.Bridge"); +Clazz.defineMethod(c$, "extendLadder", +function(index1, index2){ +if (this.ladder[0][0] > index1) this.ladder[0][0] = index1; +if (this.ladder[0][1] < index1) this.ladder[0][1] = index1; +if (this.ladder[1][0] > index2) this.ladder[1][0] = index2; +if (this.ladder[1][1] < index2) this.ladder[1][1] = index2; +}, "~N,~N"); +Clazz.overrideMethod(c$, "toString", +function(){ +return (this.isAntiparallel ? "a " : "p ") + this.a + " - " + this.b + "\t" + JU.Escape.e(this.ladder); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/dssx/DSSP.js b/config/plugins/visualizations/jmol/static/j2s/J/dssx/DSSP.js new file mode 100755 index 000000000000..d0add9efe685 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/dssx/DSSP.js @@ -0,0 +1,366 @@ +Clazz.declarePackage("J.dssx"); +Clazz.load(null, "J.dssx.DSSP", ["java.util.Hashtable", "JU.AU", "$.BS", "$.Lst", "$.PT", "$.SB", "J.c.STR", "J.dssx.Bridge", "J.i18n.GT", "JM.HBond", "JU.Escape", "$.Logger", "JV.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.bioPolymers = null; +this.vHBonds = null; +this.done = null; +this.doReport = false; +this.dsspIgnoreHydrogens = false; +this.setStructure = false; +this.labels = null; +this.bsBad = null; +this.bioPolymerCount = 0; +this.htBridges = null; +this.htLadders = null; +this.bridgesA = null; +this.bridgesP = null; +this.isDSSP2 = false; +this.sheetOffsets = null; +Clazz.instantialize(this, arguments);}, J.dssx, "DSSP", null); +Clazz.prepareFields (c$, function(){ +this.sheetOffsets = Clazz.newArray(-1, [ Clazz.newIntArray(-1, [0, -1, 1, 0, 1, 0, 0, -1]), Clazz.newIntArray(-1, [0, 0, 0, 0, 1, -1, 1, -1])]); +}); +Clazz.makeConstructor(c$, +function(){ +}); +Clazz.defineMethod(c$, "calculateDssp", +function(objBioPolymers, bioPolymerCount, objVHBonds, doReport, dsspIgnoreHydrogens, setStructure, version){ +this.bioPolymers = objBioPolymers; +this.bioPolymerCount = bioPolymerCount; +this.vHBonds = objVHBonds; +this.doReport = doReport; +this.dsspIgnoreHydrogens = dsspIgnoreHydrogens; +this.setStructure = setStructure; +this.isDSSP2 = (version > 1); +var bsAmino = new JU.BS(); +for (var i = 0; i < bioPolymerCount; i++) if (Clazz.instanceOf(this.bioPolymers[i],"JM.AminoPolymer")) bsAmino.set(i); + +if (bsAmino.isEmpty()) return ""; +var m = this.bioPolymers[0].model; +var sb = new JU.SB(); +sb.append("Jmol ").append(JV.Viewer.getJmolVersion()).append(" DSSP analysis for model ").append(m.ms.getModelNumberDotted(m.modelIndex)).append(" - ").append(m.ms.getModelTitle(m.modelIndex)).append("\n"); +if (m.modelIndex == 0) sb.append("\nW. Kabsch and C. Sander, Biopolymers, vol 22, 1983, pp 2577-2637\n\nWe thank Wolfgang Kabsch and Chris Sander for writing the DSSP software,\nand we thank the CMBI for maintaining it to the extent that it was easy to\nre-engineer in Java for our purposes. \n\nSecond generation DSSP 2.0 is ").append(this.isDSSP2 ? "" : "NOT ").append("used in this analysis. See Int. J. Mol. Sci. 2014, 15, 7841-7864; doi:10.3390/ijms15057841.\n"); +if (setStructure && m.modelIndex == 0) sb.append("\nAll bioshapes have been deleted and must be regenerated.\n"); +if (m.altLocCount > 0) sb.append("\nNote: This model contains alternative locations. Use 'CONFIGURATION 1' to be consistent with CMBI DSSP.\n"); +this.labels = Clazz.newCharArray (bioPolymerCount, '\0'); +this.done = new Array(bioPolymerCount); +this.bsBad = new JU.BS(); +var haveWarned = false; +for (var i = bsAmino.nextSetBit(0); i >= 0; i = bsAmino.nextSetBit(i + 1)) { +var ap = this.bioPolymers[i]; +if (!haveWarned && (ap.monomers[0]).getExplicitNH() != null) { +if (dsspIgnoreHydrogens) sb.append(J.i18n.GT.o(J.i18n.GT.$("NOTE: Backbone amide hydrogen positions are present and will be ignored. Their positions will be approximated, as in standard DSSP analysis.\nUse {0} to not use this approximation.\n\n"), "SET dsspCalculateHydrogenAlways FALSE")); + else sb.append(J.i18n.GT.o(J.i18n.GT.$("NOTE: Backbone amide hydrogen positions are present and will be used. Results may differ significantly from standard DSSP analysis.\nUse {0} to ignore these hydrogen positions.\n\n"), "SET dsspCalculateHydrogenAlways TRUE")); +haveWarned = true; +}ap.recalculateLeadMidpointsAndWingVectors(); +var n = ap.monomerCount; +this.labels[i] = Clazz.newCharArray (n, '\0'); +this.done[i] = new JU.BS(); +for (var j = 0; j < n; j++) if ((ap.monomers[j]).getCarbonylOxygenAtom() == null) this.bsBad.set(ap.monomers[j].leadAtomIndex); + +} +var min = this.getDualHydrogenBondArray(); +this.bridgesA = new JU.Lst(); +this.bridgesP = new JU.Lst(); +this.htBridges = new java.util.Hashtable(); +this.htLadders = new java.util.Hashtable(); +this.getBridges(min); +this.getSheetStructures(); +var reports = new Array(bioPolymerCount); +for (var i = bsAmino.nextSetBit(0); i >= 0; i = bsAmino.nextSetBit(i + 1)) if (min[i] != null) reports[i] = this.findHelixes(i, min[i]); + +if (doReport) { +var sbSummary = new JU.SB(); +sb.append("\n------------------------------\n"); +for (var i = bsAmino.nextSetBit(0); i >= 0; i = bsAmino.nextSetBit(i + 1)) if (this.labels[i] != null) { +var ap = this.bioPolymers[i]; +sbSummary.append(this.dumpSummary(ap, this.labels[i])); +sb.append(reports[i]).append(this.dumpTags(ap, "$.1: " + String.valueOf(this.labels[i]), this.bsBad, 2)); +} +if (this.bsBad.nextSetBit(0) >= 0) sb.append("\nNOTE: '!' indicates a residue that is missing a backbone carbonyl oxygen atom.\n"); +sb.append("\n").append("SUMMARY:" + sbSummary); +}return sb.toString(); +}, "~A,~N,~O,~B,~B,~B,~N"); +Clazz.defineMethod(c$, "getDualHydrogenBondArray", +function(){ +var min = JU.AU.newInt4(this.bioPolymerCount); +for (var i = 0; i < this.bioPolymerCount; i++) { +if (!(Clazz.instanceOf(this.bioPolymers[i],"JM.AminoPolymer"))) continue; +var n = this.bioPolymers[i].monomerCount; +min[i] = Clazz.newIntArray (n, 2, 3, 0); +for (var j = 0; j < n; ++j) { +min[i][j][0][1] = min[i][j][1][1] = -2147483648; +min[i][j][0][2] = min[i][j][1][2] = 0; +} +} +for (var i = 0; i < this.bioPolymerCount; i++) if (min[i] != null) for (var j = 0; j < this.bioPolymerCount; j++) if (min[j] != null) this.bioPolymers[i].calcRasmolHydrogenBonds(this.bioPolymers[j], null, null, null, 2, min[i], false, this.dsspIgnoreHydrogens); + + +return min; +}); +Clazz.defineMethod(c$, "getBridges", +function(min){ +var atoms = this.bioPolymers[0].model.ms.at; +var bridge = null; +var htTemp = new java.util.Hashtable(); +for (var p1 = 0; p1 < min.length; p1++) if (Clazz.instanceOf(this.bioPolymers[p1],"JM.AminoPolymer")) { +var ap1 = (this.bioPolymers[p1]); +var n = min[p1].length - 1; +for (var a = 1; a < n; a++) { +var ia = ap1.monomers[a].leadAtomIndex; +if (this.bsBad.get(ia)) continue; +for (var p2 = p1; p2 < min.length; p2++) if (Clazz.instanceOf(this.bioPolymers[p2],"JM.AminoPolymer")) for (var b = (p1 == p2 ? a + 3 : 1); b < min[p2].length - 1; b++) { +var ap2 = this.bioPolymers[p2]; +var ib = ap2.monomers[b].leadAtomIndex; +if (this.bsBad.get(ib)) continue; +if ((bridge = this.getBridge(min, p1, a, p2, b, this.bridgesP, atoms[ia], atoms[ib], ap1, ap2, htTemp, false)) != null) { +} else if ((bridge = this.getBridge(min, p1, a, p2, b, this.bridgesA, atoms[ia], atoms[ib], ap1, ap2, htTemp, true)) != null) { +bridge.isAntiparallel = true; +} else { +continue; +}if (JU.Logger.debugging) JU.Logger.debug("Bridge found " + bridge); +this.done[p1].set(a); +this.done[p2].set(b); +this.htBridges.put(ia + "-" + ib, bridge); +} + +} +} +}, "~A"); +Clazz.defineMethod(c$, "getBridge", +function(min, p1, a, p2, b, bridges, atom1, atom2, ap1, ap2, htTemp, isAntiparallel){ +var b1 = null; +var b2 = null; +var ipt = 0; +var offsets = (isAntiparallel ? this.sheetOffsets[1] : this.sheetOffsets[0]); +if ((b1 = this.isHbonded(a + offsets[0], b + offsets[1], p1, p2, min)) != null && (b2 = this.isHbonded(b + offsets[2], a + offsets[3], p2, p1, min)) != null || (b1 = this.isHbonded(a + offsets[ipt = 4], b + offsets[5], p1, p2, min)) != null && (b2 = this.isHbonded(b + offsets[6], a + offsets[7], p2, p1, min)) != null) { +var bridge = new J.dssx.Bridge(atom1, atom2, this.htLadders); +bridges.addLast(bridge); +if (this.vHBonds != null) { +var type = (isAntiparallel ? 14336 : 6144); +this.addHbond(ap1.monomers[a + offsets[ipt]], ap2.monomers[b + offsets[++ipt]], b1[2], type, htTemp); +this.addHbond(ap2.monomers[b + offsets[++ipt]], ap1.monomers[a + offsets[++ipt]], b2[2], type, htTemp); +}return bridge; +}return null; +}, "~A,~N,~N,~N,~N,JU.Lst,JM.Atom,JM.Atom,JM.AminoPolymer,JM.AminoPolymer,java.util.Map,~B"); +Clazz.defineMethod(c$, "addHbond", +function(donor, acceptor, iEnergy, type, htTemp){ +var nitrogen = (donor).getNitrogenAtom(); +var oxygen = (acceptor).getCarbonylOxygenAtom(); +if (htTemp != null) { +var key = nitrogen.i + " " + oxygen.i; +if (htTemp.containsKey(key)) return; +htTemp.put(key, Boolean.TRUE); +}this.vHBonds.addLast( new JM.HBond(nitrogen, oxygen, type, 1, 0, iEnergy / 1000)); +}, "JM.Monomer,JM.Monomer,~N,~N,java.util.Map"); +Clazz.defineMethod(c$, "getSheetStructures", +function(){ +if (this.bridgesA.size() == 0 && this.bridgesP.size() == 0) return; +this.createLadders(this.bridgesA, true); +this.createLadders(this.bridgesP, false); +var bsEEE = new JU.BS(); +var bsB = new JU.BS(); +for (var ladder, $ladder = this.htLadders.keySet().iterator (); $ladder.hasNext()&& ((ladder = $ladder.next ()) || true);) { +if (ladder[0][0] == ladder[0][1] && ladder[1][0] == ladder[1][1]) { +bsB.set(ladder[0][0]); +bsB.set(ladder[1][0]); +} else { +bsEEE.setBits(ladder[0][0], ladder[0][1] + 1); +bsEEE.setBits(ladder[1][0], ladder[1][1] + 1); +}} +var bsSheet = new JU.BS(); +var bsBridge = new JU.BS(); +for (var i = this.bioPolymers.length; --i >= 0; ) { +if (!(Clazz.instanceOf(this.bioPolymers[i],"JM.AminoPolymer"))) continue; +bsSheet.clearAll(); +bsBridge.clearAll(); +var ap = this.bioPolymers[i]; +for (var iStart = 0; iStart < ap.monomerCount; ) { +var index = ap.monomers[iStart].leadAtomIndex; +if (bsEEE.get(index)) { +var iEnd = iStart + 1; +while (iEnd < ap.monomerCount && bsEEE.get(ap.monomers[iEnd].leadAtomIndex)) iEnd++; + +bsSheet.setBits(iStart, iEnd); +iStart = iEnd; +} else { +if (bsB.get(index)) bsBridge.set(iStart); +++iStart; +}} +if (this.doReport) { +this.setTag(this.labels[i], bsBridge, 'B'); +this.setTag(this.labels[i], bsSheet, 'E'); +}if (this.setStructure) { +ap.setStructureBS(0, 3, J.c.STR.SHEET, bsSheet, false); +}this.done[i].or(bsSheet); +this.done[i].or(bsBridge); +} +}); +Clazz.defineMethod(c$, "createLadders", +function(bridges, isAntiparallel){ +var dir = (isAntiparallel ? -1 : 1); +var n = bridges.size(); +for (var i = 0; i < n; i++) this.checkBridge(bridges.get(i), isAntiparallel, 1, dir); + +for (var i = 0; i < n; i++) this.checkBulge(bridges.get(i), isAntiparallel, 1); + +}, "JU.Lst,~B"); +Clazz.defineMethod(c$, "checkBridge", +function(bridge, isAntiparallel, n1, n2){ +var b = this.htBridges.get(bridge.a.getOffsetResidueAtom("\0", n1) + "-" + bridge.b.getOffsetResidueAtom("\0", n2)); +return (b != null && bridge.addBridge(b, this.htLadders)); +}, "J.dssx.Bridge,~B,~N,~N"); +Clazz.defineMethod(c$, "checkBulge", +function(bridge, isAntiparallel, dir){ +var dir1 = (isAntiparallel ? -1 : 1); +for (var i = 0; i < 3; i++) for (var j = (i == 0 ? 1 : 0); j < 6; j++) { +this.checkBridge(bridge, isAntiparallel, i * dir, j * dir1); +if (j > i) this.checkBridge(bridge, isAntiparallel, j * dir, i * dir1); +} + +}, "J.dssx.Bridge,~B,~N"); +Clazz.defineMethod(c$, "dumpSummary", +function(ap, labels){ +var a = ap.monomers[0].getLeadAtom(); +var id = a.getChainID(); +var prefix = (id == 0 ? "" : a.getChainIDStr() + ":"); +var sb = new JU.SB(); +var lastChar = '\u0000'; +var insCode1 = '\u0000'; +var insCode2 = '\u0000'; +var firstResno = -1; +var lastResno = -1; +var n = ap.monomerCount; +var m = ap.monomers; +for (var i = 0; i <= n; i++) { +if (i == n || labels[i] != lastChar) { +if (lastChar != '\0') sb.appendC('\n').appendC(lastChar).append(" : ").append(prefix).appendI(firstResno).append(insCode1 == '\0' ? "" : String.valueOf(insCode1)).append("_").append(prefix).appendI(lastResno).append(insCode2 == '\0' ? "" : String.valueOf(insCode2)); +if (i == n) break; +lastChar = labels[i]; +firstResno = m[i].getResno(); +insCode1 = m[i].getInsertionCode(); +}lastResno = m[i].getResno(); +insCode2 = m[i].getInsertionCode(); +} +return sb.toString(); +}, "JM.AminoPolymer,~A"); +Clazz.defineMethod(c$, "dumpTags", +function(ap, lines, bsBad, mode){ +var prefix = ap.monomers[0].getLeadAtom().getChainID() + "." + (ap.bioPolymerIndexInModel + 1); +lines = JU.PT.rep(lines, "$", prefix); +var iFirst = ap.monomers[0].getResno(); +var pre = "\n" + prefix; +var sb = new JU.SB(); +var sb0 = new JU.SB().append(pre + ".8: "); +var sb1 = new JU.SB().append(pre + ".7: "); +var sb2 = new JU.SB().append(pre + ".6: "); +var sb3 = new JU.SB().append(pre + ".0: "); +var i = iFirst; +var n = ap.monomerCount; +for (var ii = 0; ii < n; ii++) { +i = ap.monomers[ii].getResno(); +sb0.append(i % 100 == 0 ? "" + ((Clazz.doubleToInt(i / 100)) % 100) : " "); +sb1.append(i % 10 == 0 ? "" + ((Clazz.doubleToInt(i / 10)) % 10) : " "); +sb2.appendI(i % 10); +sb3.appendC(bsBad.get(ap.monomers[ii].leadAtomIndex) ? '!' : ap.monomers[ii].getGroup1()); +} +if ((mode & 1) == 1) sb.appendSB(sb0).appendSB(sb1).appendSB(sb2); +sb.append("\n"); +sb.append(lines); +if ((mode & 2) == 2) { +sb.appendSB(sb3); +sb.append("\n\n"); +}return sb.toString().$replace('\0', '.'); +}, "JM.AminoPolymer,~S,JU.BS,~N"); +Clazz.defineMethod(c$, "isHbonded", +function(indexDonor, indexAcceptor, pDonor, pAcceptor, min){ +if (indexDonor < 0 || indexAcceptor < 0) return null; +var min1 = min[pDonor]; +var min2 = min[pAcceptor]; +if (indexDonor >= min1.length || indexAcceptor >= min2.length) return null; +return (min1[indexDonor][0][0] == pAcceptor && min1[indexDonor][0][1] == indexAcceptor ? min1[indexDonor][0] : min1[indexDonor][1][0] == pAcceptor && min1[indexDonor][1][1] == indexAcceptor ? min1[indexDonor][1] : null); +}, "~N,~N,~N,~N,~A"); +Clazz.defineMethod(c$, "findHelixes", +function(iPolymer, min){ +var ap = this.bioPolymers[iPolymer]; +if (JU.Logger.debugging) for (var j = 0; j < ap.monomerCount; j++) JU.Logger.debug(iPolymer + "." + ap.monomers[j].getResno() + "\t" + JU.Escape.e(min[j])); + +var bsTurn = new JU.BS(); +var line3; +var line4; +var line5; +if (this.isDSSP2) { +line5 = this.findHelixes2(0, iPolymer, 5, min, J.c.STR.HELIXPI, 12288, bsTurn, true); +line4 = this.findHelixes2(2, iPolymer, 4, min, J.c.STR.HELIXALPHA, 10240, bsTurn, false); +line3 = this.findHelixes2(4, iPolymer, 3, min, J.c.STR.HELIX310, 8192, bsTurn, false); +} else { +line4 = this.findHelixes2(2, iPolymer, 4, min, J.c.STR.HELIXALPHA, 10240, bsTurn, true); +line3 = this.findHelixes2(4, iPolymer, 3, min, J.c.STR.HELIX310, 8192, bsTurn, false); +line5 = this.findHelixes2(0, iPolymer, 5, min, J.c.STR.HELIXPI, 12288, bsTurn, false); +}if (this.setStructure) ap.setStructureBS(0, 6, J.c.STR.TURN, bsTurn, false); +if (this.doReport) { +this.setTag(this.labels[iPolymer], bsTurn, 'T'); +return this.dumpTags(ap, "$.5: " + line5 + "\n" + "$.4: " + line4 + "\n" + "$.3: " + line3, this.bsBad, 1); +}return ""; +}, "~N,~A"); +Clazz.defineMethod(c$, "findHelixes2", +function(mmtfType, iPolymer, pitch, min, subtype, type, bsTurn, isFirst){ +var ap = this.bioPolymers[iPolymer]; +var bsStart = new JU.BS(); +var bsNNN = new JU.BS(); +var bsX = new JU.BS(); +var bsStop = new JU.BS(); +var bsHelix = new JU.BS(); +var bsDone = this.done[iPolymer]; +var warning = ""; +var n = ap.monomerCount; +for (var i = pitch; i < n; ++i) { +var i0 = i - pitch; +var bpt = 0; +if (min[i][0][0] == iPolymer && min[i][0][1] == i0 || min[i][bpt = 1][0] == iPolymer && min[i][1][1] == i0) { +var ia = ap.monomers[i0].leadAtomIndex; +var ipt = this.bsBad.nextSetBit(ia); +var m = ap.monomers[i]; +if (ipt >= ia && ipt <= m.leadAtomIndex) continue; +bsStart.set(i0); +bsNNN.setBits(i0 + 1, i); +bsStop.set(i); +ipt = bsDone.nextSetBit(i0); +var isClear = (ipt < 0 || ipt >= i); +var addH = false; +if (i0 > 0 && bsStart.get(i0 - 1) && (isFirst || isClear)) { +bsHelix.setBits(i0, i); +if (!isClear) warning += " WARNING! Bridge to helix at " + ap.monomers[ipt]; +addH = true; +} else if (isClear || bsDone.nextClearBit(ipt) < i) { +addH = true; +}if (bsStop.get(i0)) bsX.set(i0); +if (addH && this.vHBonds != null) { +this.addHbond(m, ap.monomers[i0], min[i][bpt][2], type, null); +}}} +var taglines; +if (this.doReport) { +taglines = Clazz.newCharArray (n, '\0'); +this.setTag(taglines, bsNNN, String.fromCharCode(48 + pitch)); +this.setTag(taglines, bsStart, '>'); +this.setTag(taglines, bsStop, '<'); +this.setTag(taglines, bsX, 'X'); +} else { +taglines = null; +}bsDone.or(bsHelix); +bsNNN.andNot(bsDone); +bsTurn.or(bsNNN); +bsTurn.andNot(bsHelix); +if (this.setStructure) ap.setStructureBS(0, mmtfType, subtype, bsHelix, false); +if (this.doReport) { +this.setTag(this.labels[iPolymer], bsHelix, String.fromCharCode(68 + pitch)); +return String.valueOf(taglines) + warning; +}return ""; +}, "~N,~N,~N,~A,J.c.STR,~N,JU.BS,~B"); +Clazz.defineMethod(c$, "setTag", +function(tags, bs, ch){ +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) tags[i] = ch; + +}, "~A,JU.BS,~S"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/dssx/DSSR0.js b/config/plugins/visualizations/jmol/static/j2s/J/dssx/DSSR0.js new file mode 100755 index 000000000000..d665941700b2 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/dssx/DSSR0.js @@ -0,0 +1,5 @@ +Clazz.declarePackage("J.dssx"); +(function(){ +var c$ = Clazz.declareType(J.dssx, "DSSR0", null); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/dssx/DSSR1.js b/config/plugins/visualizations/jmol/static/j2s/J/dssx/DSSR1.js new file mode 100755 index 000000000000..816d2cfb3ad7 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/dssx/DSSR1.js @@ -0,0 +1,279 @@ +Clazz.declarePackage("J.dssx"); +Clazz.load(["J.dssx.AnnotationParser"], "J.dssx.DSSR1", ["JU.BS", "$.Lst", "$.P3", "$.PT", "JM.HBond", "JM.BasePair", "JU.Escape", "$.Logger"], function(){ +var c$ = Clazz.declareType(J.dssx, "DSSR1", J.dssx.AnnotationParser); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.dssx.DSSR1, []); +}); +Clazz.overrideMethod(c$, "calculateDSSRStructure", +function(vwr, bsAtoms){ +var bs = vwr.ms.getModelBS(bsAtoms == null ? vwr.bsA() : bsAtoms, true); +var s = ""; +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) s += this.getDSSRForModel(vwr, i) + "\n"; + +return s; +}, "JV.Viewer,JU.BS"); +Clazz.defineMethod(c$, "getDSSRForModel", +function(vwr, modelIndex){ +var info = null; +var out = null; +while (true) { +if (!vwr.ms.am[modelIndex].isBioModel) break; +info = vwr.ms.getModelAuxiliaryInfo(modelIndex); +if (info.containsKey("dssr")) break; +var bs = vwr.restrictToModel(vwr.ms.getAtoms(2097166, null), modelIndex); +if (bs.nextClearBit(0) < 0) { +info = null; +break; +}try { +var name = vwr.setLoadFormat(false, "=dssrModel/", '=', false); +name = JU.PT.rep(name, "%20", " "); +JU.Logger.info("fetching " + name + "[pdb data]"); +var data = vwr.getPdbAtomData(bs, null, false, false); +var modelNumber = vwr.getModelNumber(vwr.ms.getModelBS(bs, false).nextSetBit(0)); +var s = " " + modelNumber; +data = "MODEL" + s.substring(s.length - 9) + "\n" + data + "ENDMDL\n"; +data = vwr.getFileAsString3(name + data, false, null); +var x = vwr.parseJSONMap(data); +if (x != null) { +info.put("dssr", x); +this.setGroup1(vwr.ms, modelIndex); +this.fixDSSRJSONMap(x); +this.setBioPolymers(vwr.ms.am[modelIndex], false); +}} catch (e) { +info = null; +out = "" + e; +} +break; +} +return (info != null ? JU.PT.rep(JU.Escape.escapeMap((info.get("dssr")).get("counts")), ",", ",\n") : out == null ? "model has no nucleotides" : out); +}, "JV.Viewer,~N"); +Clazz.overrideMethod(c$, "fixDSSRJSONMap", +function(map){ +var s = ""; +try { +this.fixIndices(map, "kissingLoops", "hairpin"); +this.fixIndices(map, "coaxStacks", "stem"); +if (map.containsKey("counts")) s += "_M.dssr.counts = " + map.get("counts").toString() + "\n"; +if (map.containsKey("dbn")) s += "_M.dssr.dbn = " + map.get("dbn").toString(); +} catch (e) { +} +return s; +}, "java.util.Map"); +Clazz.defineMethod(c$, "fixIndices", +function(map, key, root){ +var indices = root + "_indices"; +var original = root + "s"; +var lst = map.get(key); +if (lst != null) { +var hpins = map.get(original); +for (var i = lst.size(); --i >= 0; ) { +var kmap = lst.get(i); +var khlist = kmap.get(indices); +var n = khlist.size(); +if (n > 0) { +var khpins = new JU.Lst(); +kmap.put(original, khpins); +for (var j = n; --j >= 0; ) khpins.addLast(hpins.get((khlist.get(j)).intValue() - 1)); + +}} +}}, "java.util.Map,~S,~S"); +Clazz.overrideMethod(c$, "getBasePairs", +function(vwr, modelIndex){ +var ms = vwr.ms; +var info = ms.getInfo(modelIndex, "dssr"); +var pairs = (info == null ? null : info.get("pairs")); +var singles = (info == null ? null : info.get("ssSegments")); +if (pairs == null && singles == null) { +this.setBioPolymers(vwr.ms.am[modelIndex], true); +return; +}var bsAtoms = ms.am[modelIndex].bsAtoms; +try { +var bs = new JU.BS(); +var atoms = ms.at; +if (pairs != null) for (var i = pairs.size(); --i >= 0; ) { +var map = pairs.get(i); +var unit1 = map.get("nt1"); +var unit2 = map.get("nt2"); +var a1 = ms.getSequenceBits(unit1, bsAtoms, bs).nextSetBit(0); +bs.clearAll(); +var a2 = ms.getSequenceBits(unit2, bsAtoms, bs).nextSetBit(0); +bs.clearAll(); +JM.BasePair.add(map, this.setRes(atoms[a1]), this.setRes(atoms[a2])); +} +if (singles != null) for (var i = singles.size(); --i >= 0; ) { +var map = singles.get(i); +var units = map.get("nts_long"); +ms.getSequenceBits(units, bsAtoms, bs); +for (var j = bs.nextSetBit(0); j >= 0; j = bs.nextSetBit(j + 1)) this.setRes(atoms[j]); + +} +} catch (e) { +JU.Logger.error("Exception " + e + " in DSSRParser.getBasePairs"); +} +}, "JV.Viewer,~N"); +Clazz.defineMethod(c$, "setBioPolymers", +function(m, b){ +var n = m.getBioPolymerCount(); +for (var i = n; --i >= 0; ) { +var bp = m.bioPolymers[i]; +if (bp.isNucleic()) (bp).isDssrSet = b; +} +}, "JM.BioModel,~B"); +Clazz.defineMethod(c$, "setRes", +function(atom){ +if (atom.group.getBioPolymerLength() == 0) return null; +var m = atom.group; +(m.bioPolymer).isDssrSet = true; +return m; +}, "JM.Atom"); +Clazz.overrideMethod(c$, "getAtomBits", +function(vwr, key, dbObj, annotationCache, type, modelIndex, bsModel){ +if (dbObj == null) return new JU.BS(); +var doCache = !key.contains("NOCACHE"); +if (!doCache) { +key = JU.PT.rep(key, "NOCACHE", "").trim(); +}var bs = null; +bs = new JU.BS(); +if (doCache) annotationCache.put(key, bs); +try { +key = JU.PT.rep(key, "[where", "[select * where"); +key = JU.PT.rep(key, "[WHERE", "[select * where"); +var ext = ""; +var n = -2147483648; +var pt = key.toLowerCase().indexOf("[select"); +if (pt >= 0) { +ext = key.substring(pt); +key = key.substring(0, pt); +pt = ext.lastIndexOf("].."); +if (pt >= 0 && (n = JU.PT.parseInt(ext.substring(pt + 3))) != -2147483648) ext = ext.substring(0, pt + 1); +}pt = key.toLowerCase().indexOf(" where "); +if (pt < 0) { +key = key.toLowerCase(); +pt = (n == -2147483648 ? key.lastIndexOf('.') : -1); +var haveIndex = false; +if (pt >= 0 && (haveIndex = (n = JU.PT.parseInt(key.substring(pt + 1))) != -2147483648)) key = key.substring(0, pt); +pt = "..bulges.nts_long..coaxstacks.stems.pairs.nt*..hairpins.nts_long..hbonds.atom1_id;atom2_id..helices.pairs.nt*..iloops.nts_long..isocanonpairs.nt*..junctions.nts_long..kissingloops.hairpins.nts_long..multiplets.nts_long..nonstack.nts_long..nts.nt_id..pairs.nt*..sssegments.nts_long..stacks.nts_long..stems.pairs.nt*..".indexOf(".." + key) + 2; +var len = key.length; +if (pt < 2) return bs; +var ptLast = (haveIndex ? pt + len : 2147483647); +while (pt >= 2 && pt < ptLast && len > 0) { +if (key.indexOf(".") < 0 && "..bulges.nts_long..coaxstacks.stems.pairs.nt*..hairpins.nts_long..hbonds.atom1_id;atom2_id..helices.pairs.nt*..iloops.nts_long..isocanonpairs.nt*..junctions.nts_long..kissingloops.hairpins.nts_long..multiplets.nts_long..nonstack.nts_long..nts.nt_id..pairs.nt*..sssegments.nts_long..stacks.nts_long..stems.pairs.nt*..".substring(pt + len, pt + len + 2).equals("..")) { +key = "[select (" + key + ")]"; +}dbObj = vwr.extractProperty(dbObj, key, -1); +pt += len + 1; +if (ext.length > 0) { +dbObj = vwr.extractProperty(dbObj, ext, -1); +ext = ""; +}var pt1 = "..bulges.nts_long..coaxstacks.stems.pairs.nt*..hairpins.nts_long..hbonds.atom1_id;atom2_id..helices.pairs.nt*..iloops.nts_long..isocanonpairs.nt*..junctions.nts_long..kissingloops.hairpins.nts_long..multiplets.nts_long..nonstack.nts_long..nts.nt_id..pairs.nt*..sssegments.nts_long..stacks.nts_long..stems.pairs.nt*..".indexOf(".", pt); +key = "..bulges.nts_long..coaxstacks.stems.pairs.nt*..hairpins.nts_long..hbonds.atom1_id;atom2_id..helices.pairs.nt*..iloops.nts_long..isocanonpairs.nt*..junctions.nts_long..kissingloops.hairpins.nts_long..multiplets.nts_long..nonstack.nts_long..nts.nt_id..pairs.nt*..sssegments.nts_long..stacks.nts_long..stems.pairs.nt*..".substring(pt, pt1); +len = key.length; +} +} else { +key = key.substring(0, pt).trim() + "[select * " + key.substring(pt + 1) + "]" + ext; +dbObj = vwr.extractProperty(dbObj, key, -1); +}if (n != -2147483648 && Clazz.instanceOf(dbObj,"JU.Lst")) { +if (n <= 0) n += (dbObj).size(); +dbObj = (dbObj).get(n - 1); +}bs.or(vwr.ms.getAtoms(1086324744, dbObj.toString())); +bs.and(bsModel); +} catch (e) { +System.out.println(e.toString() + " in AnnotationParser"); +bs.clearAll(); +} +return bs; +}, "JV.Viewer,~S,~O,java.util.Map,~N,~N,JU.BS"); +Clazz.overrideMethod(c$, "getHBonds", +function(ms, modelIndex, vHBonds, doReport){ +var info = ms.getInfo(modelIndex, "dssr"); +var list; +if (info == null || (list = info.get("hbonds")) == null) return "no DSSR hydrogen-bond data"; +var bsAtoms = ms.am[modelIndex].bsAtoms; +var unit1 = null; +var unit2 = null; +var a1 = 0; +var a2 = 0; +try { +var bs = new JU.BS(); +for (var i = list.size(); --i >= 0; ) { +var map = list.get(i); +unit1 = map.get("atom1_id"); +a1 = ms.getSequenceBits(unit1, bsAtoms, bs).nextSetBit(0); +if (a1 < 0) { +JU.Logger.error("Atom " + unit1 + " was not found"); +continue; +}unit2 = map.get("atom2_id"); +bs.clearAll(); +a2 = ms.getSequenceBits(unit2, bsAtoms, bs).nextSetBit(0); +if (a2 < 0) { +JU.Logger.error("Atom " + unit2 + " was not found"); +continue; +}bs.clearAll(); +var energy = 0; +vHBonds.addLast( new JM.HBond(ms.at[a1], ms.at[a2], 2048, 1, 0, energy)); +} +} catch (e) { +} +return "DSSR reports " + list.size() + " hydrogen bonds"; +}, "JM.ModelSet,~N,JU.Lst,~B"); +Clazz.overrideMethod(c$, "setGroup1", +function(ms, modelIndex){ +var info = ms.getInfo(modelIndex, "dssr"); +var list; +if (info == null || (list = info.get("nts")) == null) return; +var m = ms.am[modelIndex]; +var bsAtoms = m.bsAtoms; +var atoms = ms.at; +var bs = new JU.BS(); +for (var i = list.size(); --i >= 0; ) { +var map = list.get(i); +var ch = (map.get("nt_code")).charAt(0); +var unit1 = map.get("nt_id"); +ms.bioModelset.getAllSequenceBits(unit1, bsAtoms, bs); +var pt = bs.nextSetBit(0); +if (pt < 0) continue; +if ("ACGTU".indexOf(ch) < 0) atoms[pt].group.group1 = ch; +atoms[pt].group.dssrNT = map; +bs.clearAll(); +} +}, "JM.ModelSet,~N"); +Clazz.overrideMethod(c$, "getAtomicDSSRData", +function(ms, modelIndex, dssrData, dataType){ +var info = ms.getInfo(modelIndex, "dssr"); +var list; +if (info == null || (list = info.get(dataType)) == null) return; +var bsAtoms = ms.am[modelIndex].bsAtoms; +try { +var bs = new JU.BS(); +for (var i = list.size(); --i >= 0; ) { +var map = list.get(i); +bs.clearAll(); +ms.getSequenceBits(map.toString(), bsAtoms, bs); +for (var j = bs.nextSetBit(0); j >= 0; j = bs.nextSetBit(j + 1)) dssrData[j] = i; + +} +} catch (e) { +} +}, "JM.ModelSet,~N,~A,~S"); +Clazz.overrideMethod(c$, "getDSSRFrame", +function(nt){ +var frame = nt.get("frame"); +if (frame == null) return null; +var oxyz = new Array(4); +for (var i = 4; --i >= 0; ) oxyz[i] = new JU.P3(); + +this.getPoint(frame, "origin", oxyz[0]); +this.getPoint(frame, "x_axis", oxyz[1]); +this.getPoint(frame, "y_axis", oxyz[2]); +this.getPoint(frame, "z_axis", oxyz[3]); +return oxyz; +}, "java.util.Map"); +Clazz.defineMethod(c$, "getPoint", +function(frame, item, pt){ +var xyz = frame.get(item); +pt.x = xyz.get(0).floatValue(); +pt.y = xyz.get(1).floatValue(); +pt.z = xyz.get(2).floatValue(); +}, "java.util.Map,~S,JU.P3"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/Export3D.js b/config/plugins/visualizations/jmol/static/j2s/J/export/Export3D.js new file mode 100755 index 000000000000..d3a40aff9c4c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/Export3D.js @@ -0,0 +1,397 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["J.api.JmolRendererInterface", "JU.P3"], "J.export.Export3D", ["J.api.Interface", "J.g3d.HermiteRenderer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.exporter = null; +this.privateKey = 0; +this.gdata = null; +this.colix = 0; +this.hermite3d = null; +this.width = 0; +this.height = 0; +this.slab = 0; +this.depth = 0; +this.exportName = null; +this.webGL = false; +this.isCartesian = false; +this.ptA = null; +this.ptB = null; +this.ptC = null; +this.ptD = null; +Clazz.instantialize(this, arguments);}, J["export"], "Export3D", null, J.api.JmolRendererInterface); +Clazz.prepareFields (c$, function(){ +this.ptA = new JU.P3(); +this.ptB = new JU.P3(); +this.ptC = new JU.P3(); +this.ptD = new JU.P3(); +}); +Clazz.makeConstructor(c$, +function(){ +}); +Clazz.overrideMethod(c$, "isWebGL", +function(){ +return this.webGL; +}); +Clazz.overrideMethod(c$, "initializeExporter", +function(vwr, privateKey, gdata, params){ +this.exportName = params.get("type"); +this.webGL = this.exportName.equals("JS"); +if ((this.exporter = J.api.Interface.getOption("export." + (this.webGL ? "" : "_") + this.exportName + "Exporter", vwr, "export")) == null) return null; +this.exporter.export3D = this; +this.isCartesian = (this.exporter.exportType == 1); +this.gdata = gdata; +gdata.setNewWindowParametersForExport(); +this.slab = gdata.slab; +this.width = gdata.width; +this.height = gdata.height; +this.privateKey = privateKey; +return (this.initializeOutput(vwr, privateKey, params) ? this.exporter : null); +}, "JV.Viewer,~N,JU.GData,java.util.Map"); +Clazz.overrideMethod(c$, "initializeOutput", +function(vwr, privateKey, params){ +return this.exporter.initializeOutput(vwr, privateKey, this.gdata, params); +}, "JV.Viewer,~N,java.util.Map"); +Clazz.overrideMethod(c$, "getExportType", +function(){ +return this.exporter.exportType; +}); +Clazz.overrideMethod(c$, "getExportName", +function(){ +return this.exportName; +}); +Clazz.overrideMethod(c$, "finalizeOutput", +function(){ +return this.exporter.finalizeOutput(); +}); +Clazz.overrideMethod(c$, "setSlab", +function(slabValue){ +this.gdata.setSlab(slabValue); +this.slab = this.gdata.slab; +}, "~N"); +Clazz.overrideMethod(c$, "setSlabAndZShade", +function(slabValue, depthValue, zSlab, zDepth, zPower){ +this.gdata.setSlab(slabValue); +this.slab = this.gdata.slab; +this.gdata.setDepth(depthValue); +this.depth = this.gdata.depth; +}, "~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "renderBackground", +function(me){ +if (!this.isCartesian) this.gdata.renderBackground(me); +}, "J.api.JmolRendererInterface"); +Clazz.overrideMethod(c$, "drawAtom", +function(atom, radius){ +this.exporter.drawAtom(atom, radius); +}, "JM.Atom,~N"); +Clazz.overrideMethod(c$, "drawRect", +function(x, y, z, zSlab, rWidth, rHeight){ +if (this.webGL) { +return; +}if (zSlab != 0 && this.gdata.isClippedZ(zSlab)) return; +var w = rWidth - 1; +var h = rHeight - 1; +var xRight = x + w; +var yBottom = y + h; +if (y >= 0 && y < this.height) this.drawHLine(x, y, z, w); +if (yBottom >= 0 && yBottom < this.height) this.drawHLine(x, yBottom, z, w); +if (x >= 0 && x < this.width) this.drawVLine(x, y, z, h); +if (xRight >= 0 && xRight < this.width) this.drawVLine(xRight, y, z, h); +}, "~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "drawHLine", +function(x, y, z, w){ +var argbCurrent = this.gdata.getColorArgbOrGray(this.colix); +if (w < 0) { +x += w; +w = -w; +}for (var i = 0; i <= w; i++) { +this.exporter.drawTextPixel(argbCurrent, x + i, y, z); +} +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "drawVLine", +function(x, y, z, h){ +var argbCurrent = this.gdata.getColorArgbOrGray(this.colix); +if (h < 0) { +y += h; +h = -h; +}for (var i = 0; i <= h; i++) { +this.exporter.drawTextPixel(argbCurrent, x, y + i, z); +} +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawFilledCircle", +function(colixRing, colixFill, diameter, x, y, z){ +if (!this.gdata.isClippedZ(z)) this.exporter.drawFilledCircle(colixRing, colixFill, diameter, x, y, z); +}, "~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "drawCircle", +function(colix, diameter, x, y, z, doFill){ +if (!this.gdata.isClippedZ(z)) this.exporter.drawCircle(x, y, z, diameter, colix, doFill); +}, "~N,~N,~N,~N,~N,~B"); +Clazz.overrideMethod(c$, "fillSphereXYZ", +function(diameter, x, y, z){ +this.ptA.set(x, y, z); +this.fillSphereBits(diameter, this.ptA); +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "fillSphereI", +function(diameter, center){ +this.ptA.set(center.x, center.y, center.z); +this.fillSphereBits(diameter, this.ptA); +}, "~N,JU.P3i"); +Clazz.overrideMethod(c$, "fillSphereBits", +function(diameter, center){ +if (diameter != 0) this.exporter.fillSphere(this.colix, diameter, center); +}, "~N,JU.P3"); +Clazz.overrideMethod(c$, "fillTextRect", +function(x, y, z, zSlab, widthFill, heightFill){ +if (this.isCartesian || this.gdata.isClippedZ(zSlab)) return; +z = this.exporter.fixScreenZ(z); +this.ptA.set(x, y, z); +this.ptB.set(x + widthFill, y, z); +this.ptC.set(x + widthFill, y + heightFill, z); +this.ptD.set(x, y + heightFill, z); +this.fillQuadrilateral(this.ptA, this.ptB, this.ptC, this.ptD, false); +}, "~N,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawString", +function(str, font3d, xBaseline, yBaseline, z, zSlab, bgcolix){ +if (str != null && !this.gdata.isClippedZ(zSlab)) this.drawStringNoSlab(str, font3d, xBaseline, yBaseline, z, bgcolix); +}, "~S,JU.Font,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawStringNoSlab", +function(str, font3d, xBaseline, yBaseline, z, bgcolix){ +if (str == null) return; +z = Math.max(this.slab, z); +if (font3d == null) font3d = this.gdata.getFont3DCurrent(); + else this.gdata.setFont(font3d); +this.exporter.plotText(xBaseline, yBaseline, z, this.colix, str, font3d); +}, "~S,JU.Font,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawImage", +function(objImage, x, y, z, zSlab, bgcolix, width, height){ +if (this.isCartesian || objImage == null || width == 0 || height == 0 || this.gdata.isClippedZ(zSlab)) return; +z = Math.max(this.slab, z); +this.exporter.plotImage(x, y, z, objImage, bgcolix, width, height); +}, "~O,~N,~N,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawPixel", +function(x, y, z){ +this.plotPixelClipped(x, y, z); +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "plotPixelClipped", +function(x, y, z){ +if (this.isClipped(x, y, z)) return; +this.exporter.drawPixel(this.colix, x, y, z, 1); +}, "~N,~N,~N"); +Clazz.overrideMethod(c$, "plotPixelClippedP3i", +function(screen){ +if (this.isClipped(screen.x, screen.y, screen.z)) return; +this.exporter.drawPixel(this.colix, screen.x, screen.y, screen.z, 1); +}, "JU.P3i"); +Clazz.overrideMethod(c$, "drawPoints", +function(count, coordinates, scale){ +for (var i = count * 3; i > 0; ) { +var z = coordinates[--i]; +var y = coordinates[--i]; +var x = coordinates[--i]; +if (this.isClipped(x, y, z)) continue; +this.exporter.drawPixel(this.colix, x, y, z, scale); +} +}, "~N,~A,~N"); +Clazz.overrideMethod(c$, "drawDashedLineBits", +function(run, rise, pointA, pointB){ +this.exporter.fillCylinderScreenMad(this.colix, 2, this.exporter.lineWidthMad, pointA, pointB); +}, "~N,~N,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "drawLineXYZ", +function(x1, y1, z1, x2, y2, z2){ +this.ptA.set(x1, y1, z1); +this.ptB.set(x2, y2, z2); +this.exporter.fillCylinderScreenMad(this.colix, 2, this.exporter.lineWidthMad, this.ptA, this.ptB); +}, "~N,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawLine", +function(colixA, colixB, xA, yA, zA, xB, yB, zB){ +this.fillCylinderXYZ(colixA, colixB, 2, this.exporter.lineWidthMad, xA, yA, zA, xB, yB, zB); +}, "~N,~N,~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "drawLineBits", +function(colixA, colixB, pointA, pointB){ +this.fillCylinderBits2(colixA, colixB, 2, this.exporter.lineWidthMad, pointA, pointB); +}, "~N,~N,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "drawLineAB", +function(pointA, pointB){ +this.exporter.fillCylinderScreenMad(this.colix, 2, this.exporter.lineWidthMad, pointA, pointB); +}, "JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "drawBond", +function(atomA, atomB, colixA, colixB, endcaps, mad, bondOrder){ +if (mad == 1) mad = this.exporter.lineWidthMad; +this.exporter.drawCylinder(atomA, atomB, colixA, colixB, endcaps, mad, bondOrder); +}, "JU.P3,JU.P3,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "fillCylinderXYZ", +function(colixA, colixB, endcaps, mad, xA, yA, zA, xB, yB, zB){ +this.ptA.set(xA, yA, zA); +this.ptB.set(xB, yB, zB); +this.exporter.drawCylinder(this.ptA, this.ptB, colixA, colixB, endcaps, mad, 1); +}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "fillCylinderScreen3I", +function(endcaps, diameter, pointA, pointB, pt0f, pt1f, radius){ +if (diameter <= 0) return; +this.exporter.fillCylinderScreen(this.colix, endcaps, diameter, pointA, pointB, pt0f, pt1f, radius); +}, "~N,~N,JU.P3,JU.P3,JU.P3,JU.P3,~N"); +Clazz.overrideMethod(c$, "fillCylinder", +function(endcaps, diameter, pointA, pointB){ +if (diameter <= 0) return; +this.ptA.set(pointA.x, pointA.y, pointA.z); +this.ptB.set(pointB.x, pointB.y, pointB.z); +this.exporter.fillCylinderScreenMad(this.colix, endcaps, diameter, this.ptA, this.ptB); +}, "~N,~N,JU.P3i,JU.P3i"); +Clazz.overrideMethod(c$, "fillCylinderBits", +function(endcaps, diameter, pointA, pointB){ +if (diameter == 0) return; +if (this.isCartesian) { +this.exporter.fillCylinderScreen(this.colix, endcaps, diameter, pointA, pointB, null, null, 0); +} else { +this.exporter.fillCylinderScreenMad(this.colix, endcaps, diameter, pointA, pointB); +}}, "~N,~N,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "fillConeScreen3f", +function(endcap, screenDiameter, pointBase, screenTip, isBarb){ +this.exporter.fillConeScreen(this.colix, endcap, screenDiameter, pointBase, screenTip, isBarb); +}, "~N,~N,JU.P3,JU.P3,~B"); +Clazz.overrideMethod(c$, "drawHermite4", +function(tension, s0, s1, s2, s3){ +this.hermite3d.renderHermiteRope(false, tension, 0, 0, 0, s0, s1, s2, s3); +}, "~N,JU.P3,JU.P3,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "fillHermite", +function(tension, diameterBeg, diameterMid, diameterEnd, s0, s1, s2, s3){ +this.hermite3d.renderHermiteRope(true, tension, diameterBeg, diameterMid, diameterEnd, s0, s1, s2, s3); +}, "~N,~N,~N,~N,JU.P3,JU.P3,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "drawTriangle3C", +function(screenA, colixA, screenB, colixB, screenC, colixC, check){ +if ((check & 1) == 1) this.drawLine(colixA, colixB, screenA.x, screenA.y, screenA.z, screenB.x, screenB.y, screenB.z); +if ((check & 2) == 2) this.drawLine(colixB, colixC, screenB.x, screenB.y, screenB.z, screenC.x, screenC.y, screenC.z); +if ((check & 4) == 4) this.drawLine(colixA, colixC, screenA.x, screenA.y, screenA.z, screenC.x, screenC.y, screenC.z); +}, "JU.P3i,~N,JU.P3i,~N,JU.P3i,~N,~N"); +Clazz.defineMethod(c$, "drawLineBits", +function(screenA, screenB, colixA, colixB){ +this.exporter.drawCylinder(screenA, screenB, colixA, colixB, 2, this.exporter.lineWidthMad, 1); +}, "JU.P3,JU.P3,~N,~N"); +Clazz.overrideMethod(c$, "fillCylinderBits2", +function(colixA, colixB, endcaps, mad, screenA, screenB){ +this.exporter.drawCylinder(screenA, screenB, colixA, colixB, endcaps, mad, 1); +}, "~N,~N,~N,~N,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "fillTriangle3CNBits", +function(pA, colixA, nA, pB, colixB, nB, pC, colixC, nC, twoSided){ +if (colixA != colixB || colixB != colixC) { +return; +}this.exporter.fillTriangle(colixA, pA, pB, pC, twoSided); +}, "JU.P3,~N,~N,JU.P3,~N,~N,JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "fillTriangle3CN", +function(pointA, colixA, normixA, pointB, colixB, normixB, pointC, colixC, normixC){ +}, "JU.P3i,~N,~N,JU.P3i,~N,~N,JU.P3i,~N,~N"); +Clazz.overrideMethod(c$, "fillTriangleTwoSided", +function(normix, a, b, c){ +this.exporter.fillTriangle(this.colix, a, b, c, true); +}, "~N,JU.P3,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "fillTriangle3f", +function(pointA, pointB, pointC, setNoisy){ +this.exporter.fillTriangle(this.colix, pointA, pointB, pointC, false); +}, "JU.P3,JU.P3,JU.P3,~B"); +Clazz.overrideMethod(c$, "fillTriangle3i", +function(screenA, screenB, screenC, ptA0, ptB0, ptC0, doShade){ +this.exporter.fillTriangle(this.colix, screenA, screenB, screenC, true); +}, "JU.P3,JU.P3,JU.P3,JU.T3,JU.T3,JU.T3,~B"); +Clazz.overrideMethod(c$, "fillQuadrilateral", +function(pointA, pointB, pointC, pointD, isSolid){ +this.exporter.fillTriangle(this.colix, pointA, pointB, pointC, false); +this.exporter.fillTriangle(this.colix, pointA, pointC, pointD, false); +}, "JU.P3,JU.P3,JU.P3,JU.P3,~B"); +Clazz.overrideMethod(c$, "drawSurface", +function(meshSurface, colix){ +this.exporter.drawSurface(meshSurface, colix); +}, "JU.MeshSurface,~N"); +Clazz.overrideMethod(c$, "fillEllipsoid", +function(center, points, x, y, z, diameter, mToEllipsoidal, coef, mDeriv, selectedOctant, octantPoints){ +this.exporter.fillEllipsoid(center, points, this.colix, x, y, z, diameter, mToEllipsoidal, coef, mDeriv, octantPoints); +}, "JU.P3,~A,~N,~N,~N,~N,JU.M3,~A,JU.M4,~N,~A"); +Clazz.overrideMethod(c$, "drawEllipse", +function(ptAtom, ptX, ptY, fillArc, wireframeOnly){ +return this.exporter.drawEllipse(ptAtom, ptX, ptY, this.colix, fillArc); +}, "JU.P3,JU.P3,JU.P3,~B,~B"); +Clazz.overrideMethod(c$, "isAntialiased", +function(){ +return false; +}); +Clazz.overrideMethod(c$, "checkTranslucent", +function(isAlphaTranslucent){ +return true; +}, "~B"); +Clazz.overrideMethod(c$, "haveTranslucentObjects", +function(){ +return true; +}); +Clazz.overrideMethod(c$, "setC", +function(colix){ +this.colix = colix; +this.gdata.setC(colix); +return true; +}, "~N"); +Clazz.overrideMethod(c$, "isInDisplayRange", +function(x, y){ +return (this.isCartesian || this.gdata.isInDisplayRange(x, y)); +}, "~N,~N"); +Clazz.defineMethod(c$, "clipCode", +function(x, y, z){ +return (this.isCartesian ? this.gdata.clipCode(z) : this.gdata.clipCode3(x, y, z)); +}, "~N,~N,~N"); +Clazz.overrideMethod(c$, "isClippedXY", +function(diameter, x, y){ +return (!this.isCartesian && this.gdata.isClippedXY(diameter, x, y)); +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "isClipped", +function(x, y, z){ +return (this.gdata.isClippedZ(z) || this.isClipped(x, y)); +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "isClipped", +function(x, y){ +return (!this.isCartesian && this.gdata.isClipped(x, y)); +}, "~N,~N"); +Clazz.defineMethod(c$, "getPrivateKey", +function(){ +return this.privateKey; +}); +Clazz.overrideMethod(c$, "volumeRender4", +function(diam, x, y, z){ +this.fillSphereXYZ(diam, x, y, z); +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "renderCrossHairs", +function(minMax, screenWidth, screenHeight, navigationOffset, navigationDepthPercent){ +}, "~A,~N,~N,JU.P3,~N"); +Clazz.overrideMethod(c$, "volumeRender", +function(TF){ +}, "~B"); +Clazz.overrideMethod(c$, "addRenderer", +function(tok){ +if (tok == 553648143) this.hermite3d = new J.g3d.HermiteRenderer().set(this, this.gdata); +}, "~N"); +Clazz.overrideMethod(c$, "plotImagePixel", +function(argb, x, y, z, shade, bgargb, width, height, pbuf, p, transpLog){ +if (this.webGL) return; +z = Math.max(this.slab, z); +if (shade != 0) { +var a = (shade == 8 ? 0xFF : ((8 - shade) << 4) + (8 - shade)); +argb = (argb & 0xFFFFFF) | (a << 24); +}this.exporter.drawTextPixel(argb, x, y, z); +}, "~N,~N,~N,~N,~N,~N,~N,~N,~A,~O,~N"); +Clazz.overrideMethod(c$, "drawHermite7", +function(fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, colixBack){ +if (colixBack == 0 || this.webGL) { +this.hermite3d.renderHermiteRibbon(fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, 0); +return; +}this.hermite3d.renderHermiteRibbon(fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, 1); +var colix = this.colix; +this.setC(colixBack); +this.hermite3d.renderHermiteRibbon(fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, -1); +this.setC(colix); +}, "~B,~B,~N,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,~N,~N"); +Clazz.overrideMethod(c$, "renderAllStrings", +function(jr){ +if (this.webGL) { +return; +}this.gdata.renderAllStrings(this); +}, "~O"); +Clazz.overrideMethod(c$, "drawLinePixels", +function(sA, sB, z, zslab){ +return; +}, "JU.P3i,JU.P3i,~N,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/JSExporter.js b/config/plugins/visualizations/jmol/static/j2s/J/export/JSExporter.js new file mode 100755 index 000000000000..d249754bdfbe --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/JSExporter.js @@ -0,0 +1,127 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["J.export.__CartesianExporter", "java.util.Hashtable", "J.export.Export3D", "$.___Exporter"], "J.export.JSExporter", ["J.export.UseTable"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.htSpheresRendered = null; +this.htObjects = null; +this.html5Applet = null; +this.useTable = null; +this.ret = null; +Clazz.instantialize(this, arguments);}, J["export"], "JSExporter", J["export"].__CartesianExporter); +Clazz.prepareFields (c$, function(){ +this.htSpheresRendered = new java.util.Hashtable(); +this.htObjects = new java.util.Hashtable(); +this.ret = new Array(1); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J["export"].JSExporter, []); +}); +Clazz.defineMethod(c$, "jsInitExport", +function(applet){ +}, "~O"); +Clazz.defineMethod(c$, "jsEndExport", +function(applet){ +}, "~O"); +Clazz.defineMethod(c$, "jsCylinder", +function(applet, id, isNew, pt1, pt2, o){ +}, "~O,~S,~B,JU.P3,JU.P3,~A"); +Clazz.defineMethod(c$, "jsSphere", +function(applet, id, isNew, pt, o){ +}, "~O,~S,~B,JU.T3,~A"); +Clazz.defineMethod(c$, "jsSurface", +function(applet, vertices, normals, indices, nVertices, nPolygons, nFaces, bsPolygons, faceVertexMax, color, vertexColors, polygonColors){ +}, "~O,~A,~A,~A,~N,~N,~N,JU.BS,~N,~N,~A,~A"); +Clazz.defineMethod(c$, "jsTriangle", +function(applet, color, pt1, pt2, pt3){ +}, "~O,~N,JU.T3,JU.T3,JU.T3"); +Clazz.overrideMethod(c$, "outputHeader", +function(){ +this.html5Applet = this.vwr.html5Applet; +this.useTable = new J["export"].UseTable("JS"); +this.htSpheresRendered.clear(); +this.htObjects.clear(); +this.jsInitExport(this.html5Applet); +}); +Clazz.overrideMethod(c$, "outputFooter", +function(){ +this.jsEndExport(this.html5Applet); +this.htSpheresRendered.clear(); +this.htObjects.clear(); +this.useTable = null; +}); +Clazz.overrideMethod(c$, "outputSphere", +function(ptCenter, radius, colix, checkRadius){ +var iRad = Math.round(radius * 100); +var check = J["export"].___Exporter.round(ptCenter) + (checkRadius ? " " + iRad : ""); +if (this.htSpheresRendered.get(check) != null) return; +this.htSpheresRendered.put(check, Boolean.TRUE); +var found = this.useTable.getDefRet("S" + colix + "_" + iRad, this.ret); +var o; +if (found) o = this.htObjects.get(this.ret[0]); + else this.htObjects.put(this.ret[0], o = Clazz.newArray(-1, [this.getColor(colix), Float.$valueOf(radius)])); +this.jsSphere(this.html5Applet, this.ret[0], !found, ptCenter, o); +}, "JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputCylinder", +function(ptCenter, pt1, pt2, colix, endcaps, radius, ptX, ptY, checkRadius){ +if (ptX != null) return false; +var length = pt1.distance(pt2); +var found = this.useTable.getDefRet("C" + colix + "_" + Math.round(length * 100) + "_" + radius + "_" + endcaps, this.ret); +var o; +if (found) o = this.htObjects.get(this.ret[0]); + else this.htObjects.put(this.ret[0], o = Clazz.newArray(-1, [this.getColor(colix), Float.$valueOf(length), Float.$valueOf(radius)])); +this.jsCylinder(this.html5Applet, this.ret[0], !found, pt1, pt2, o); +return true; +}, "JU.P3,JU.P3,JU.P3,~N,~N,~N,JU.P3,JU.P3,~B"); +Clazz.overrideMethod(c$, "outputCircle", +function(pt1, pt2, radius, colix, doFill){ +}, "JU.P3,JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputEllipsoid", +function(center, points, colix){ +}, "JU.P3,~A,~N"); +Clazz.overrideMethod(c$, "outputCone", +function(ptBase, ptTip, radius, colix){ +this.outputCylinder(null, ptBase, ptTip, colix, 0, radius, null, null, false); +}, "JU.P3,JU.P3,~N,~N"); +Clazz.defineMethod(c$, "getColor", +function(colix){ +return Integer.$valueOf(this.gdata.getColorArgbOrGray(colix)); +}, "~N"); +Clazz.overrideMethod(c$, "outputSurface", +function(vertices, normals, vertexColixes, indices, polygonColixes, nVertices, nPolygons, nTriangles, bsPolygons, faceVertexMax, colix, colorList, htColixes, offset){ +var vertexColors = this.getColors(vertexColixes); +var polygonColors = this.getColors(polygonColixes); +this.jsSurface(this.html5Applet, vertices, normals, indices, nVertices, nPolygons, nTriangles, bsPolygons, faceVertexMax, this.gdata.getColorArgbOrGray(colix), vertexColors, polygonColors); +}, "~A,~A,~A,~A,~A,~N,~N,~N,JU.BS,~N,~N,JU.Lst,java.util.Map,JU.P3"); +Clazz.overrideMethod(c$, "outputTriangle", +function(pt1, pt2, pt3, colix){ +this.jsTriangle(this.html5Applet, this.gdata.getColorArgbOrGray(colix), pt1, pt2, pt3); +}, "JU.T3,JU.T3,JU.T3,~N"); +Clazz.overrideMethod(c$, "outputTextPixel", +function(pt, argb){ +}, "JU.P3,~N"); +Clazz.overrideMethod(c$, "outputFace", +function(is, coordMap, faceVertexMax){ +}, "~A,~A,~N"); +Clazz.defineMethod(c$, "output", +function(pt){ +}, "JU.T3"); +Clazz.overrideMethod(c$, "plotImage", +function(x, y, z, image, bgcolix, width, height){ +}, "~N,~N,~N,~O,~N,~N,~N"); +Clazz.overrideMethod(c$, "plotText", +function(x, y, z, colix, text, font3d){ +}, "~N,~N,~N,~N,~S,JU.Font"); +Clazz.defineMethod(c$, "getColors", +function(colixes){ +if (colixes == null) return null; +var colors = Clazz.newIntArray (colixes.length, 0); +for (var i = colors.length; --i >= 0; ) { +colors[i] = this.gdata.getColorArgbOrGray(colixes[i]); +} +return colors; +}, "~A"); +{ +{ +Jmol && Jmol.GLmol && Jmol.GLmol.extendJSExporter(J.export.JSExporter.prototype); +}}}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/MeshData.js b/config/plugins/visualizations/jmol/static/j2s/J/export/MeshData.js new file mode 100755 index 000000000000..4ad6b98b72fb --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/MeshData.js @@ -0,0 +1,87 @@ +Clazz.declarePackage("J.export"); +Clazz.load(null, "J.export.MeshData", ["JU.AU", "$.P3", "$.V3", "JU.MeshSurface"], function(){ +var c$ = Clazz.declareType(J["export"], "MeshData", null); +c$.getCircleData = Clazz.defineMethod(c$, "getCircleData", +function(){ +var ndeg = 10; +var n = Clazz.doubleToInt(360 / ndeg); +var vertexCount = n + 1; +var faces = JU.AU.newInt2(n); +for (var i = 0; i < n; i++) { +faces[i] = Clazz.newIntArray(-1, [i, (i + 1) % n, n]); +} +var vertexes = new Array(vertexCount); +var normals = new Array(vertexCount); +for (var i = 0; i < n; i++) { +var x = (Math.cos(i * ndeg / 180. * 3.141592653589793)); +var y = (Math.sin(i * ndeg / 180. * 3.141592653589793)); +vertexes[i] = JU.P3.new3(x, y, 0); +normals[i] = JU.P3.new3(0, 0, 1); +} +vertexes[n] = JU.P3.new3(0, 0, 0); +normals[n] = JU.P3.new3(0, 0, 1); +return JU.MeshSurface.newMesh(false, vertexes, 0, faces, normals, 0); +}); +c$.getTriangleData = Clazz.defineMethod(c$, "getTriangleData", +function(pt1, pt2, pt3){ +var vertexes = Clazz.newArray(-1, [pt1, pt2, pt3]); +var v1 = JU.V3.newVsub(pt3, pt1); +var v2 = JU.V3.newVsub(pt2, pt1); +v2.cross(v2, v1); +v2.normalize(); +var normals = Clazz.newArray(-1, [v2, v2, v2]); +var faces = Clazz.newArray(-1, [ Clazz.newIntArray(-1, [0, 1, 2])]); +return JU.MeshSurface.newMesh(false, vertexes, 0, faces, normals, 0); +}, "JU.T3,JU.T3,JU.T3"); +c$.getConeData = Clazz.defineMethod(c$, "getConeData", +function(){ +var ndeg = 10; +var n = Clazz.doubleToInt(360 / ndeg); +var vertices = new Array(n + 1); +var faces = JU.AU.newInt2(n); +for (var i = 0; i < n; i++) faces[i] = Clazz.newIntArray(-1, [i, (i + 1) % n, n]); + +var d = ndeg / 180. * 3.141592653589793; +for (var i = 0; i < n; i++) { +var x = (Math.cos(i * d)); +var y = (Math.sin(i * d)); +vertices[i] = JU.P3.new3(x, y, 0); +} +vertices[n] = JU.P3.new3(0, 0, 1); +return JU.MeshSurface.newMesh(false, vertices, 0, faces, vertices, 0); +}); +c$.getCylinderData = Clazz.defineMethod(c$, "getCylinderData", +function(inSide){ +var ndeg = 10; +var vertexCount = Clazz.doubleToInt(360 / ndeg) * 2; +var n = Clazz.doubleToInt(vertexCount / 2); +var faces = JU.AU.newInt2(vertexCount); +var fpt = -1; +for (var i = 0; i < n; i++) { +if (inSide) { +faces[++fpt] = Clazz.newIntArray(-1, [i + n, (i + 1) % n, i]); +faces[++fpt] = Clazz.newIntArray(-1, [i + n, (i + 1) % n + n, (i + 1) % n]); +} else { +faces[++fpt] = Clazz.newIntArray(-1, [i, (i + 1) % n, i + n]); +faces[++fpt] = Clazz.newIntArray(-1, [(i + 1) % n, (i + 1) % n + n, i + n]); +}} +var vertexes = new Array(vertexCount); +var normals = new Array(vertexCount); +for (var i = 0; i < n; i++) { +var x = (Math.cos(i * ndeg / 180. * 3.141592653589793)); +var y = (Math.sin(i * ndeg / 180. * 3.141592653589793)); +vertexes[i] = JU.P3.new3(x, y, 0); +normals[i] = JU.P3.new3(x, y, 0); +} +for (var i = 0; i < n; i++) { +var x = (Math.cos((i + 0.5) * ndeg / 180 * 3.141592653589793)); +var y = (Math.sin((i + 0.5) * ndeg / 180 * 3.141592653589793)); +vertexes[i + n] = JU.P3.new3(x, y, 1); +normals[i + n] = normals[i]; +} +if (inSide) for (var i = 0; i < n; i++) normals[i].scale(-1); + +return JU.MeshSurface.newMesh(false, vertexes, 0, faces, normals, 0); +}, "~B"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/UseTable.js b/config/plugins/visualizations/jmol/static/j2s/J/export/UseTable.js new file mode 100755 index 000000000000..2c1316400f41 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/UseTable.js @@ -0,0 +1,28 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["java.util.Hashtable"], "J.export.UseTable", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.iObj = 0; +this.keyword = null; +this.term = '\0'; +Clazz.instantialize(this, arguments);}, J["export"], "UseTable", java.util.Hashtable); +Clazz.makeConstructor(c$, +function(keyword){ +Clazz.superConstructor (this, J["export"].UseTable, []); +this.keyword = keyword; +this.term = keyword.charAt(keyword.length - 1); +}, "~S"); +Clazz.defineMethod(c$, "getDef", +function(key){ +if (this.containsKey(key)) return this.keyword + this.get(key) + this.term; +var id = "_" + (this.iObj++); +this.put(key, id); +return id; +}, "~S"); +Clazz.defineMethod(c$, "getDefRet", +function(key, ret){ +if ((ret[0] = this.get(key)) != null) return true; +this.put(key, ret[0] = "_" + key.charAt(0) + (this.iObj++)); +return false; +}, "~S,~A"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/_IdtfExporter.js b/config/plugins/visualizations/jmol/static/j2s/J/export/_IdtfExporter.js new file mode 100755 index 000000000000..734d3ecf4530 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/_IdtfExporter.js @@ -0,0 +1,532 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["J.export.__CartesianExporter", "java.util.Hashtable", "JU.AU", "$.M4", "$.P3", "$.SB"], "J.export._IdtfExporter", ["JU.Lst", "$.Quat", "JU.C", "$.Geodesic", "JV.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.haveSphere = false; +this.haveCylinder = false; +this.haveCylinderIn = false; +this.haveCone = false; +this.haveCircle = false; +this.ptMin = null; +this.ptMax = null; +this.iObj = 0; +this.htDefs = null; +this.m = null; +this.models = null; +this.resources = null; +this.modifiers = null; +this.htNodes = null; +this.cylinderMatrix = null; +this.sbTemp = null; +this.triangleFace = null; +Clazz.instantialize(this, arguments);}, J["export"], "_IdtfExporter", J["export"].__CartesianExporter); +Clazz.prepareFields (c$, function(){ +this.ptMin = JU.P3.new3(1e10, 1e10, 1e10); +this.ptMax = JU.P3.new3(-1.0E10, -1.0E10, -1.0E10); +this.htDefs = new java.util.Hashtable(); +this.m = new JU.M4(); +this.models = new JU.SB(); +this.resources = new JU.SB(); +this.modifiers = new JU.SB(); +this.htNodes = new java.util.Hashtable(); +this.cylinderMatrix = new JU.M4(); +this.triangleFace = JU.AU.newInt2(1); +{ +this.triangleFace[0] = Clazz.newIntArray(-1, [0, 1, 2]); +}}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J["export"]._IdtfExporter, []); +this.commentChar = "% "; +}); +Clazz.defineMethod(c$, "output", +function(pt){ +this.output(pt, this.sbTemp, true); +}, "JU.T3"); +Clazz.defineMethod(c$, "output", +function(pt, sb, checkpt){ +if (checkpt) this.checkPoint(pt); +sb.append(J["export"].___Exporter.round(pt.x)).append(" ").append(J["export"].___Exporter.round(pt.y)).append(" ").append(J["export"].___Exporter.round(pt.z)).append(" "); +}, "JU.T3,JU.SB,~B"); +Clazz.defineMethod(c$, "checkPoint", +function(pt){ +if (pt.x < this.ptMin.x) this.ptMin.x = pt.x; +if (pt.y < this.ptMin.y) this.ptMin.y = pt.y; +if (pt.z < this.ptMin.z) this.ptMin.z = pt.z; +if (pt.x > this.ptMax.x) this.ptMax.x = pt.x; +if (pt.y > this.ptMax.y) this.ptMax.y = pt.y; +if (pt.z > this.ptMax.z) this.ptMax.z = pt.z; +}, "JU.T3"); +Clazz.overrideMethod(c$, "outputHeader", +function(){ +this.output("FILE_FORMAT \"IDTF\"\nFORMAT_VERSION 100\n"); +this.m.setIdentity(); +this.m.setToM3(this.tm.matrixRotate); +this.m.rotate2(this.referenceCenter, this.tempP1); +this.m.m03 = -this.tempP1.x; +this.m.m13 = -this.tempP1.y; +this.m.m23 = -this.tempP1.z; +this.m.m33 = 1; +this.output("NODE \"GROUP\" {\n"); +this.output("NODE_NAME \"Jmol\"\n"); +this.output("PARENT_LIST {\nPARENT_COUNT 1\n"); +this.output("PARENT 0 {\n"); +this.output(this.getParentItem("", this.m)); +this.output("}}}\n"); +}); +Clazz.overrideMethod(c$, "finalizeOutput", +function(){ +this.finalizeOutput2(); +return this.getAuxiliaryFileData(); +}); +Clazz.defineMethod(c$, "getAuxiliaryFileData", +function(){ +var fName = this.fileName.substring(this.fileName.lastIndexOf("/") + 1); +fName = fName.substring(fName.lastIndexOf("\\") + 1); +var name = fName + "."; +name = name.substring(0, name.indexOf(".")); +return "% Created by: Jmol " + JV.Viewer.getJmolVersion() + "\n% Creation date: " + this.getExportDate() + "\n% File created: " + this.fileName + " (" + this.getByteCount() + " bytes)\n\n" + "\n\\documentclass[12pt,letter]{article}" + "\n\\usepackage{hyperref}" + "\n\\usepackage{media9}" + "\n\\usepackage{verbatim}" + "\n\\pagestyle{empty}" + "\n\\begin{document}" + "\n \\begin{center}" + "\n \\addmediapath{./} % here you can set the path where is been saved the u3d file" + "\n \\includemedia[" + "\n label=" + name + "," + "\n width=0.9\\textwidth," + "\n height=0.9\\textheight," + "\n activate=pageopen," + "\n deactivate=pageclose," + "\n 3Dtoolbar=false," + "\n 3Dnavpane=false," + "\n 3Dmenu," + "\n 3Droo=" + this.cameraDistance + "," + "\n 3Dcoo= 0.0 0.0 0.0," + "\n 3Dc2c=0.0 0.0 1.0," + "\n 3Daac=" + this.apertureAngle + "," + "\n 3Droll=0.0," + "\n 3Dbg=" + this.rgbFractionalFromColix(this.backgroundColix) + ", % to set the background color for 3D vwr; white = 1 1 1; so, you need to do the proportion: '255:1=[RGB]:x'" + "\n transparent=false," + "\n 3Dlights=Headlamp," + "\n 3Drender=Solid," + "\n 3Dpartsattrs=restore," + "\n ]{}{" + name + ".u3d}" + "\n% \\\\" + "\n%\\movieref[3Dcalculate]{" + name + "}{Click here!}" + "\n\\end{center}" + "\n\\end{document}" + "\n\\begin{comment}" + this.vwr.getWrappedStateScript() + "\n\\end{comment}"; +}); +Clazz.defineMethod(c$, "getParentItem", +function(name, m){ +var sb = new JU.SB(); +sb.append("PARENT_NAME \"" + name + "\"\n"); +sb.append("PARENT_TM {\n"); +sb.append(m.m00 + " " + m.m10 + " " + m.m20 + " 0.0\n"); +sb.append(m.m01 + " " + m.m11 + " " + m.m21 + " 0.0\n"); +sb.append(m.m02 + " " + m.m12 + " " + m.m22 + " 0.0\n"); +sb.append(m.m03 + " " + m.m13 + " " + m.m23 + " " + m.m33 + "\n"); +sb.append("}\n"); +return sb.toString(); +}, "~S,JU.M4"); +Clazz.defineMethod(c$, "addColix", +function(colix, haveColors){ +var key = "_" + colix; +if (this.htDefs.containsKey(key)) return; +var color = (haveColors ? "1.0 1.0 1.0" : this.rgbFractionalFromColix(colix)); +this.htDefs.put(key, Boolean.TRUE); +this.resources.append("RESOURCE_LIST \"SHADER\" {\n"); +this.resources.append("RESOURCE_COUNT 1\n"); +this.resources.append("RESOURCE 0 {\n"); +this.resources.append("RESOURCE_NAME \"Shader" + key + "\"\n"); +this.resources.append("ATTRIBUTE_USE_VERTEX_COLOR \"FALSE\"\n"); +this.resources.append("SHADER_MATERIAL_NAME \"Mat" + key + "\"\n"); +this.resources.append("SHADER_ACTIVE_TEXTURE_COUNT 0\n"); +this.resources.append("}}\n"); +this.resources.append("RESOURCE_LIST \"MATERIAL\" {\n"); +this.resources.append("RESOURCE_COUNT 1\n"); +this.resources.append("RESOURCE 0 {\n"); +this.resources.append("RESOURCE_NAME \"Mat" + key + "\"\n"); +this.resources.append("MATERIAL_AMBIENT " + color + "\n"); +this.resources.append("MATERIAL_DIFFUSE " + color + "\n"); +this.resources.append("MATERIAL_SPECULAR 0.0 0.0 0.0\n"); +this.resources.append("MATERIAL_EMISSIVE 0.0 0.0 0.0\n"); +this.resources.append("MATERIAL_REFLECTIVITY 0.00000\n"); +this.resources.append("MATERIAL_OPACITY " + J["export"].___Exporter.opacityFractionalFromColix(colix) + "\n"); +this.resources.append("}}\n"); +}, "~N,~B"); +Clazz.defineMethod(c$, "addShader", +function(key, colix){ +this.modifiers.append("MODIFIER \"SHADING\" {\n"); +this.modifiers.append("MODIFIER_NAME \"" + key + "\"\n"); +this.modifiers.append("PARAMETERS {\n"); +this.modifiers.append("SHADER_LIST_COUNT 1\n"); +this.modifiers.append("SHADING_GROUP {\n"); +this.modifiers.append("SHADER_LIST 0 {\n"); +this.modifiers.append("SHADER_COUNT 1\n"); +this.modifiers.append("SHADER_NAME_LIST {\n"); +this.modifiers.append("SHADER 0 NAME: \"Shader_" + colix + "\"\n"); +this.modifiers.append("}}}}}\n"); +}, "~S,~N"); +Clazz.overrideMethod(c$, "outputFooter", +function(){ +this.htDefs = null; +this.outputNodes(); +this.output(this.models.toString()); +this.output(this.resources.toString()); +this.output("RESOURCE_LIST \"VIEW\" {\n"); +this.output("\tRESOURCE_COUNT 1\n"); +this.output("\tRESOURCE 0 {\n"); +this.output("\t\tRESOURCE_NAME \"View0\"\n"); +this.output("\t\tVIEW_PASS_COUNT 1\n"); +this.output("\t\tVIEW_ROOT_NODE_LIST {\n"); +this.output("\t\t\tROOT_NODE 0 {\n"); +this.output("\t\t\t\tROOT_NODE_NAME \"\"\n"); +this.output("\t\t\t}\n"); +this.output("\t\t}\n"); +this.output("\t}\n"); +this.output("}\n\n"); +this.output(this.modifiers.toString()); +}); +Clazz.defineMethod(c$, "outputNodes", +function(){ +for (var entry, $entry = this.htNodes.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) { +var key = entry.getKey(); +var v = entry.getValue(); +this.output("NODE \"MODEL\" {\n"); +this.output("NODE_NAME \"" + key + "\"\n"); +System.out.println("output idtf " + key); +var n = v.size(); +this.output("PARENT_LIST {\nPARENT_COUNT " + n + "\n"); +for (var i = 0; i < n; i++) { +this.output("PARENT " + i + " {\n"); +this.output(v.get(i)); +this.output("}\n"); +} +this.output("}\n"); +var i = key.indexOf("_"); +if (i > 0) { +key = key.substring(0, i); +}if (key.equals("Ellipse")) { +key = "Circle"; +}this.output("RESOURCE_NAME \"" + key + "_Mesh\"\n}\n"); +} +}); +Clazz.defineMethod(c$, "outputEllipsoid", +function(center, points, colix){ +var a = JU.Quat.getQuaternionFrame(center, points[1], points[3]).toAxisAngle4f(); +var sx = points[1].distance(center); +var sy = points[3].distance(center); +var sz = points[5].distance(center); +this.setSphereMatrix(center, sx, sy, sz, a, this.sphereMatrix); +this.outputEllipsoid(center, this.sphereMatrix, colix); +}, "JU.P3,~A,~N"); +Clazz.defineMethod(c$, "outputEllipsoid", +function(center, sphereMatrix, colix){ +if (!this.haveSphere) { +this.models.append(this.getSphereResource()); +this.haveSphere = true; +}this.checkPoint(center); +this.addColix(colix, false); +var key = "Sphere_" + colix; +var v = this.htNodes.get(key); +if (v == null) { +v = new JU.Lst(); +this.htNodes.put(key, v); +this.addShader(key, colix); +}v.addLast(this.getParentItem("Jmol", sphereMatrix)); +}, "JU.T3,JU.M4,~N"); +Clazz.defineMethod(c$, "getSphereResource", +function(){ +var sb = new JU.SB(); +sb.append("RESOURCE_LIST \"MODEL\" {\n").append("RESOURCE_COUNT 1\n").append("RESOURCE 0 {\n").append("RESOURCE_NAME \"Sphere_Mesh\"\n").append("MODEL_TYPE \"MESH\"\n").append("MESH {\n"); +var vertexCount = JU.Geodesic.getVertexCount(2); +var f = JU.Geodesic.getFaceVertexes(2); +var nFaces = Clazz.doubleToInt(f.length / 3); +var faces = Clazz.newIntArray (nFaces, 3, 0); +for (var i = 0, p = 0; i < nFaces; i++) for (var j = 0; j < 3; j++) faces[i][j] = f[p++]; + + +var vertexes = new Array(vertexCount); +for (var i = 0; i < vertexCount; i++) vertexes[i] = JU.Geodesic.getVertexVector(i); + +return this.getMeshData("Sphere", faces, vertexes, vertexes); +}); +Clazz.defineMethod(c$, "getMeshData", +function(type, indices, vertexes, normals){ +var nFaces = indices.length; +var vertexCount = vertexes.length; +var normalCount = normals.length; +var sb = new JU.SB(); +this.getMeshHeader(type, nFaces, vertexCount, normalCount, 0, sb); +var sb1 = new JU.SB(); +for (var i = 0; i < indices.length; i++) { +sb1.appendI(indices[i][0]).append(" "); +sb1.appendI(indices[i][1]).append(" "); +sb1.appendI(indices[i][2]).append(" "); +} +sb.append("MESH_FACE_POSITION_LIST { "); +sb.appendSB(sb1); +sb.append("}\n"); +sb.append("MESH_FACE_NORMAL_LIST { "); +sb.appendSB(sb1); +sb.append("}\n"); +sb.append("MESH_FACE_SHADING_LIST { "); +for (var i = 0; i < nFaces; i++) sb.append("0 "); + +sb.append("}\n"); +sb.append("MODEL_POSITION_LIST { "); +for (var i = 0; i < vertexCount; i++) this.output(vertexes[i], sb, false); + +sb.append("}\n"); +sb.append("MODEL_NORMAL_LIST { "); +for (var i = 0; i < normalCount; i++) this.output(normals[i], sb, false); + +sb.append("}\n}}}\n"); +return sb.toString(); +}, "~S,~A,~A,~A"); +Clazz.defineMethod(c$, "getMeshHeader", +function(type, nFaces, vertexCount, normalCount, colorCount, sb){ +sb.append("RESOURCE_LIST \"MODEL\" {\n").append("RESOURCE_COUNT 1\n").append("RESOURCE 0 {\n").append("RESOURCE_NAME \"").append(type).append("_Mesh\"\n").append("MODEL_TYPE \"MESH\"\n").append("MESH {\n").append("FACE_COUNT ").appendI(nFaces).append("\n").append("MODEL_POSITION_COUNT ").appendI(vertexCount).append("\n").append("MODEL_NORMAL_COUNT ").appendI(normalCount).append("\n").append("MODEL_DIFFUSE_COLOR_COUNT ").appendI(colorCount).append("\n").append("MODEL_SPECULAR_COLOR_COUNT 0\n").append("MODEL_TEXTURE_COORD_COUNT 0\n").append("MODEL_BONE_COUNT 0\n").append("MODEL_SHADING_COUNT 1\n").append("MODEL_SHADING_DESCRIPTION_LIST {\n").append("SHADING_DESCRIPTION 0 {\n").append("TEXTURE_LAYER_COUNT 0\n").append("SHADER_ID 0\n}}\n"); +}, "~S,~N,~N,~N,~N,JU.SB"); +Clazz.overrideMethod(c$, "outputCylinder", +function(ptCenter, pt1, pt2, colix, endcaps, radius, ptX, ptY, checkRadius){ +if (ptX != null) { +if (endcaps == 2) { +this.outputEllipse(ptCenter, pt1, ptX, ptY, colix); +this.tempP3.add2(ptCenter, ptCenter); +this.tempP3.sub(ptX); +this.outputEllipse(ptCenter, pt2, this.tempP3, ptY, colix); +}} else if (endcaps == 3) { +this.outputSphere(pt1, radius * 1.01, colix, true); +this.outputSphere(pt2, radius * 1.01, colix, true); +} else if (endcaps == 2) { +this.outputCircle(pt1, pt2, colix, radius); +this.outputCircle(pt2, pt1, colix, radius); +}if (!this.haveCylinder) { +this.models.append(this.getCylinderResource(false)); +this.haveCylinder = true; +}if (ptX != null && endcaps == 0 && !this.haveCylinderIn) { +this.models.append(this.getCylinderResource(true)); +this.haveCylinderIn = true; +}this.checkPoint(pt1); +this.checkPoint(pt2); +this.addColix(colix, false); +var n = (ptX != null && endcaps == 0 ? 2 : 1); +for (var i = 0; i < n; i++) { +var key = "Cylinder" + (i == 0 ? "_" : "In_") + colix; +var v = this.htNodes.get(key); +if (v == null) { +v = new JU.Lst(); +this.htNodes.put(key, v); +this.addShader(key, colix); +}if (ptX == null) this.cylinderMatrix.setToM3(this.getRotationMatrix(pt1, pt2, radius)); + else this.cylinderMatrix.setToM3(this.getRotationMatrix(ptCenter, pt2, radius, ptX, ptY)); +this.cylinderMatrix.m03 = pt1.x; +this.cylinderMatrix.m13 = pt1.y; +this.cylinderMatrix.m23 = pt1.z; +this.cylinderMatrix.m33 = 1; +v.addLast(this.getParentItem("Jmol", this.cylinderMatrix)); +radius *= 0.95; +} +return true; +}, "JU.P3,JU.P3,JU.P3,~N,~N,~N,JU.P3,JU.P3,~B"); +Clazz.defineMethod(c$, "outputCircle", +function(pt1, pt2, radius, colix, doFill){ +if (doFill) { +this.outputCircle(pt1, pt2, colix, radius); +return; +}}, "JU.P3,JU.P3,~N,~N,~B"); +Clazz.defineMethod(c$, "outputEllipse", +function(ptCenter, ptZ, ptX, ptY, colix){ +if (!this.haveCircle) { +this.models.append(this.getCircleResource()); +this.haveCircle = true; +this.cylinderMatrix = new JU.M4(); +}this.addColix(colix, false); +var key = "Ellipse_" + colix; +var v = this.htNodes.get(key); +if (v == null) { +v = new JU.Lst(); +this.htNodes.put(key, v); +this.addShader(key, colix); +}this.checkPoint(ptCenter); +this.cylinderMatrix.setToM3(this.getRotationMatrix(ptCenter, ptZ, 1, ptX, ptY)); +this.cylinderMatrix.m03 = ptZ.x; +this.cylinderMatrix.m13 = ptZ.y; +this.cylinderMatrix.m23 = ptZ.z; +this.cylinderMatrix.m33 = 1; +v.addLast(this.getParentItem("Jmol", this.cylinderMatrix)); +return true; +}, "JU.P3,JU.P3,JU.P3,JU.P3,~N"); +Clazz.defineMethod(c$, "outputCircle", +function(ptCenter, ptPerp, colix, radius){ +if (!this.haveCircle) { +this.models.append(this.getCircleResource()); +this.haveCircle = true; +this.cylinderMatrix = new JU.M4(); +}this.addColix(colix, false); +var key = "Circle_" + colix; +var v = this.htNodes.get(key); +if (v == null) { +v = new JU.Lst(); +this.htNodes.put(key, v); +this.addShader(key, colix); +}this.checkPoint(ptCenter); +this.cylinderMatrix.setToM3(this.getRotationMatrix(ptCenter, ptPerp, radius)); +this.cylinderMatrix.m03 = ptCenter.x; +this.cylinderMatrix.m13 = ptCenter.y; +this.cylinderMatrix.m23 = ptCenter.z; +this.cylinderMatrix.m33 = 1; +v.addLast(this.getParentItem("Jmol", this.cylinderMatrix)); +}, "JU.P3,JU.P3,~N,~N"); +Clazz.defineMethod(c$, "getCylinderResource", +function(inSide){ +var ndeg = 10; +var vertexCount = Clazz.doubleToInt(360 / ndeg) * 2; +var n = Clazz.doubleToInt(vertexCount / 2); +var faces = JU.AU.newInt2(vertexCount); +var fpt = -1; +for (var i = 0; i < n; i++) { +if (inSide) { +faces[++fpt] = Clazz.newIntArray(-1, [i + n, (i + 1) % n, i]); +faces[++fpt] = Clazz.newIntArray(-1, [i + n, (i + 1) % n + n, (i + 1) % n]); +} else { +faces[++fpt] = Clazz.newIntArray(-1, [i, (i + 1) % n, i + n]); +faces[++fpt] = Clazz.newIntArray(-1, [(i + 1) % n, (i + 1) % n + n, i + n]); +}} +var vertexes = new Array(vertexCount); +var normals = new Array(vertexCount); +for (var i = 0; i < n; i++) { +var x = (Math.cos(i * ndeg / 180. * 3.141592653589793)); +var y = (Math.sin(i * ndeg / 180. * 3.141592653589793)); +vertexes[i] = JU.P3.new3(x, y, 0); +normals[i] = JU.P3.new3(x, y, 0); +} +for (var i = 0; i < n; i++) { +var x = (Math.cos((i + 0.5) * ndeg / 180 * 3.141592653589793)); +var y = (Math.sin((i + 0.5) * ndeg / 180 * 3.141592653589793)); +vertexes[i + n] = JU.P3.new3(x, y, 1); +normals[i + n] = normals[i]; +} +if (inSide) for (var i = 0; i < n; i++) normals[i].scale(-1); + +return this.getMeshData(inSide ? "CylinderIn" : "Cylinder", faces, vertexes, normals); +}, "~B"); +Clazz.overrideMethod(c$, "outputFace", +function(face, map, faceVertexMax){ +this.sbTemp.append(" " + map[face[0]] + " " + map[face[1]] + " " + map[face[2]]); +if (faceVertexMax == 4 && face.length == 4) { +this.sbTemp.append(" " + map[face[0]] + " " + map[face[2]] + " " + map[face[3]]); +}}, "~A,~A,~N"); +Clazz.overrideMethod(c$, "outputSurface", +function(vertices, normals, colixes, indices, polygonColixes, nVertices, nPolygons, nTriangles, bsPolygons, faceVertexMax, colix, colorList, htColixes, offset){ +this.addColix(colix, polygonColixes != null || colixes != null); +if (polygonColixes != null) { +return; +}var sbFaceCoordIndices = this.sbTemp = new JU.SB(); +var map = Clazz.newIntArray (nVertices, 0); +var nCoord = this.getCoordinateMap(vertices, map, null); +this.outputIndices(indices, map, nPolygons, bsPolygons, faceVertexMax); +var sbFaceNormalIndices = this.sbTemp = new JU.SB(); +var vNormals = null; +if (normals != null) { +vNormals = new JU.Lst(); +map = this.getNormalMap(normals, nVertices, null, vNormals); +this.outputIndices(indices, map, nPolygons, bsPolygons, faceVertexMax); +}map = null; +var sbColorIndexes = new JU.SB(); +if (colorList != null) { +var isAll = (bsPolygons == null); +var i0 = (isAll ? nPolygons - 1 : bsPolygons.nextSetBit(0)); +for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsPolygons.nextSetBit(i + 1))) { +sbColorIndexes.append(" " + htColixes.get(Short.$valueOf(colixes[indices[i][0]])) + " " + htColixes.get(Short.$valueOf(colixes[indices[i][1]])) + " " + htColixes.get(Short.$valueOf(colixes[indices[i][2]]))); +if (faceVertexMax == 4 && indices[i].length == 4) sbColorIndexes.append(" " + htColixes.get(Short.$valueOf(colixes[indices[i][0]])) + " " + htColixes.get(Short.$valueOf(colixes[indices[i][2]])) + " " + htColixes.get(Short.$valueOf(colixes[indices[i][3]]))); +} +}var sbCoords = this.sbTemp = new JU.SB(); +this.outputVertices(vertices, nVertices, offset); +var sbNormals = new JU.SB(); +var nNormals = 0; +if (normals != null) { +nNormals = vNormals.size(); +for (var i = 0; i < nNormals; i++) sbNormals.append(vNormals.get(i)); + +vNormals = null; +}var sbColors = new JU.SB(); +var nColors = 0; +if (colorList != null) { +nColors = colorList.size(); +for (var i = 0; i < nColors; i++) { +var c = colorList.get(i).shortValue(); +sbColors.append(this.rgbFractionalFromColix(c)).append(" ").append(J["export"].___Exporter.translucencyFractionalFromColix(c)).append(" "); +} +}var key = "mesh" + (++this.iObj); +this.addMeshData(key, nTriangles, nCoord, nNormals, nColors, sbFaceCoordIndices, sbFaceNormalIndices, sbColorIndexes, sbCoords, sbNormals, sbColors); +var v = new JU.Lst(); +this.htNodes.put(key, v); +this.addShader(key, colix); +this.cylinderMatrix.setIdentity(); +v.addLast(this.getParentItem("Jmol", this.cylinderMatrix)); +}, "~A,~A,~A,~A,~A,~N,~N,~N,JU.BS,~N,~N,JU.Lst,java.util.Map,JU.P3"); +Clazz.defineMethod(c$, "addMeshData", +function(key, nFaces, nCoord, nNormals, nColors, sbFaceCoordIndices, sbFaceNormalIndices, sbColorIndices, sbCoords, sbNormals, sbColors){ +this.getMeshHeader(key, nFaces, nCoord, nNormals, nColors, this.models); +this.models.append("MESH_FACE_POSITION_LIST { ").appendSB(sbFaceCoordIndices).append(" }\n").append("MESH_FACE_NORMAL_LIST { ").appendSB(sbFaceNormalIndices).append(" }\n"); +this.models.append("MESH_FACE_SHADING_LIST { "); +for (var i = 0; i < nFaces; i++) this.models.append("0 "); + +this.models.append("}\n"); +if (nColors > 0) this.models.append("MESH_FACE_DIFFUSE_COLOR_LIST { ").appendSB(sbColorIndices).append(" }\n"); +this.models.append("MODEL_POSITION_LIST { ").appendSB(sbCoords).append(" }\n").append("MODEL_NORMAL_LIST { ").appendSB(sbNormals).append(" }\n"); +if (nColors > 0) this.models.append("MODEL_DIFFUSE_COLOR_LIST { ").appendSB(sbColors).append(" }\n"); +this.models.append("}}}\n"); +}, "~S,~N,~N,~N,~N,JU.SB,JU.SB,JU.SB,JU.SB,JU.SB,JU.SB"); +Clazz.overrideMethod(c$, "outputCone", +function(ptBase, ptTip, radius, colix){ +if (!this.haveCone) { +this.models.append(this.getConeResource()); +this.haveCone = true; +}this.checkPoint(ptBase); +this.checkPoint(ptTip); +this.addColix(colix, false); +var key = "Cone_" + colix; +var v = this.htNodes.get(key); +if (v == null) { +v = new JU.Lst(); +this.htNodes.put(key, v); +this.addShader(key, colix); +}this.cylinderMatrix.setToM3(this.getRotationMatrix(ptBase, ptTip, radius)); +this.cylinderMatrix.m03 = ptBase.x; +this.cylinderMatrix.m13 = ptBase.y; +this.cylinderMatrix.m23 = ptBase.z; +this.cylinderMatrix.m33 = 1; +v.addLast(this.getParentItem("Jmol", this.cylinderMatrix)); +}, "JU.P3,JU.P3,~N,~N"); +Clazz.defineMethod(c$, "getConeResource", +function(){ +var m = J["export"].___Exporter.getConeMesh(null, null, 0); +return this.getMeshData("Cone", m.pis, m.vs, m.vs); +}); +Clazz.defineMethod(c$, "getCircleResource", +function(){ +var ndeg = 10; +var n = Clazz.doubleToInt(360 / ndeg); +var vertexCount = n + 1; +var faces = JU.AU.newInt2(n); +for (var i = 0; i < n; i++) faces[i] = Clazz.newIntArray(-1, [i, (i + 1) % n, n]); + +var vertexes = new Array(vertexCount); +var normals = new Array(vertexCount); +for (var i = 0; i < n; i++) { +var x = (Math.cos(i * ndeg / 180. * 3.141592653589793)); +var y = (Math.sin(i * ndeg / 180. * 3.141592653589793)); +vertexes[i] = JU.P3.new3(x, y, 0); +normals[i] = JU.P3.new3(0, 0, 1); +} +vertexes[n] = JU.P3.new3(0, 0, 0); +normals[n] = JU.P3.new3(0, 0, 1); +return this.getMeshData("Circle", faces, vertexes, normals); +}); +Clazz.overrideMethod(c$, "outputSphere", +function(center, radius, colix, checkRadius){ +this.setSphereMatrix(center, radius, radius, radius, null, this.sphereMatrix); +this.outputEllipsoid(center, this.sphereMatrix, colix); +}, "JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputTextPixel", +function(pt, argb){ +var colix = JU.C.getColix(argb); +this.outputSphere(pt, 0.02, colix, true); +}, "JU.P3,~N"); +Clazz.overrideMethod(c$, "outputTriangle", +function(pt1, pt2, pt3, colix){ +this.addColix(colix, false); +var key = "T" + (++this.iObj); +this.models.append(this.getTriangleResource(key, pt1, pt2, pt3)); +var v = new JU.Lst(); +this.htNodes.put(key, v); +this.addShader(key, colix); +if (this.cylinderMatrix == null) this.cylinderMatrix = new JU.M4(); +this.cylinderMatrix.setIdentity(); +v.addLast(this.getParentItem("Jmol", this.cylinderMatrix)); +}, "JU.T3,JU.T3,JU.T3,~N"); +Clazz.defineMethod(c$, "getTriangleResource", +function(key, pt1, pt2, pt3){ +var vertexes = Clazz.newArray(-1, [pt1, pt2, pt3]); +this.tempV1.sub2(pt3, pt1); +this.tempV2.sub2(pt2, pt1); +this.tempV2.cross(this.tempV2, this.tempV1); +this.tempV2.normalize(); +var normals = Clazz.newArray(-1, [this.tempV2, this.tempV2, this.tempV2]); +return this.getMeshData(key, this.triangleFace, vertexes, normals); +}, "~S,JU.T3,JU.T3,JU.T3"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/_MayaExporter.js b/config/plugins/visualizations/jmol/static/j2s/J/export/_MayaExporter.js new file mode 100755 index 000000000000..70563863c63d --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/_MayaExporter.js @@ -0,0 +1,127 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["J.export.__CartesianExporter"], "J.export._MayaExporter", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.nBalls = 0; +this.nCyl = 0; +this.name = null; +this.id = null; +Clazz.instantialize(this, arguments);}, J["export"], "_MayaExporter", J["export"].__CartesianExporter); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J["export"]._MayaExporter, []); +this.commentChar = "// "; +}); +Clazz.overrideMethod(c$, "outputHeader", +function(){ +this.output("// Maya ASCII 8.5 scene\n"); +this.output("// Name: ball_stripped.ma\n"); +this.output("// Last modified: Thu, Jul 5, 2007 10:25:55 PM\n"); +this.output("// Codeset: UTF-8\n"); +this.output("requires maya \"8.5\";\n"); +this.output("currentUnit -l centimeter -a degree -t film;\n"); +this.output("fileInfo \"application\" \"maya\";\n"); +this.output("fileInfo \"product\" \"Maya Unlimited 8.5\";\n"); +this.output("fileInfo \"version\" \"8.5\";\n"); +this.output("fileInfo \"cutIdentifier\" \"200612170012-692032\";\n"); +this.output("fileInfo \"osv\" \"Mac OS X 10.4.9\"; \n"); +}); +Clazz.defineMethod(c$, "addAttr", +function(){ +this.output(" setAttr -k off \".v\";\n"); +this.output(" setAttr \".vir\" yes;\n"); +this.output(" setAttr \".vif\" yes;\n"); +this.output(" setAttr \".tw\" yes;\n"); +this.output(" setAttr \".covm[0]\" 0 1 1;\n"); +this.output(" setAttr \".cdvm[0]\" 0 1 1;\n"); +}); +Clazz.defineMethod(c$, "addConnect", +function(){ +this.output(" connectAttr \"make" + this.name + ".os\" \"" + this.id + ".cr\";\n"); +this.output("connectAttr \"" + this.id + ".iog\" \":initialShadingGroup.dsm\" -na;\n"); +}); +Clazz.defineMethod(c$, "setAttr", +function(attr, val){ +this.output(" setAttr \"." + attr + "\" " + val + ";\n"); +}, "~S,~N"); +Clazz.defineMethod(c$, "setAttr", +function(attr, val){ +this.output(" setAttr \"." + attr + "\" " + val + ";\n"); +}, "~S,~N"); +Clazz.defineMethod(c$, "setAttr", +function(attr, pt){ +this.output(" setAttr \"." + attr + "\" -type \"double3\" " + pt.x + " " + pt.y + " " + pt.z + ";\n"); +}, "~S,JU.T3"); +Clazz.overrideMethod(c$, "outputCylinder", +function(ptCenter, pt1, pt2, colix, endcaps, radius, ptX, ptY, checkRadius){ +if (ptX != null) return false; +this.nCyl++; +this.name = "nurbsCylinder" + this.nCyl; +this.id = "nurbsCylinderShape" + this.nCyl; +this.output(" createNode transform -n \"" + this.name + "\";\n"); +var length = pt1.distance(pt2); +this.tempV1.ave(pt2, pt1); +this.setAttr("t", this.tempV1); +this.tempV1.sub(pt1); +this.tempV2.setT(this.tempV1); +this.tempV2.normalize(); +var r = this.tempV1.length(); +var rX = (Math.acos(this.tempV1.y / r) * 57.29577951308232); +if (this.tempV1.x < 0) rX += 180; +var rY = (Math.atan2(this.tempV1.x, this.tempV1.z) * 57.29577951308232); +this.tempV2.set(rX, rY, 0); +this.setAttr("r", this.tempV2); +this.output(" createNode nurbsSurface -n \"" + this.id + "\" -p \"" + this.name + "\";\n"); +this.addAttr(); +this.output("createNode makeNurbCylinder -n \"make" + this.name + "\";\n"); +this.output(" setAttr \".ax\" -type \"double3\" 0 1 0;\n"); +this.setAttr("r", radius); +this.setAttr("s", 4); +this.setAttr("hr", length / radius); +this.addConnect(); +return true; +}, "JU.P3,JU.P3,JU.P3,~N,~N,~N,JU.P3,JU.P3,~B"); +Clazz.overrideMethod(c$, "outputSphere", +function(pt, radius, colix, checkRadius){ +this.nBalls++; +this.name = "nurbsSphere" + this.nBalls; +this.id = "nurbsSphereShape" + this.nBalls; +this.output("createNode transform -n \"" + this.name + "\";\n"); +this.setAttr("t", pt); +this.output("createNode nurbsSurface -n \"" + this.id + "\" -p \"" + this.name + "\";\n"); +this.addAttr(); +this.output("createNode makeNurbSphere -n \"make" + this.name + "\";\n"); +this.output(" setAttr \".ax\" -type \"double3\" 0 1 0;\n"); +this.setAttr("r", radius); +this.setAttr("s", 4); +this.setAttr("nsp", 3); +this.addConnect(); +}, "JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "drawTextPixel", +function(argb, x, y, z){ +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "outputTextPixel", +function(pt, argb){ +}, "JU.P3,~N"); +Clazz.overrideMethod(c$, "outputSurface", +function(vertices, normals, colixes, indices, polygonColixes, nVertices, nPolygons, nTriangles, bsPolygons, faceVertexMax, colix, colorList, htColixes, offset){ +}, "~A,~A,~A,~A,~A,~N,~N,~N,JU.BS,~N,~N,JU.Lst,java.util.Map,JU.P3"); +Clazz.overrideMethod(c$, "outputTriangle", +function(pt1, pt2, pt3, colix){ +}, "JU.T3,JU.T3,JU.T3,~N"); +Clazz.overrideMethod(c$, "outputCircle", +function(pt1, pt2, radius, colix, doFill){ +}, "JU.P3,JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputCone", +function(ptBase, ptTip, radius, colix){ +}, "JU.P3,JU.P3,~N,~N"); +Clazz.overrideMethod(c$, "outputEllipsoid", +function(center, points, colix){ +}, "JU.P3,~A,~N"); +Clazz.overrideMethod(c$, "outputFace", +function(is, coordMap, faceVertexMax){ +}, "~A,~A,~N"); +Clazz.defineMethod(c$, "output", +function(pt){ +}, "JU.T3"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/_ObjExporter.js b/config/plugins/visualizations/jmol/static/j2s/J/export/_ObjExporter.js new file mode 100755 index 000000000000..8512a6efd0d0 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/_ObjExporter.js @@ -0,0 +1,503 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["J.export.__CartesianExporter", "java.util.HashSet", "JU.P3"], "J.export._ObjExporter", ["java.util.Hashtable", "JU.AU", "$.BS", "$.CU", "$.Lst", "$.M4", "$.PT", "$.Quat", "$.SB", "$.V3", "J.export.MeshData", "JU.Escape", "$.Logger", "$.MeshSurface", "JV.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.surfacesOnly = false; +this.normalizeUV = true; +this.mtlout = null; +this.objFileRootName = null; +this.nMtlBytes = 0; +this.textures = null; +this.textureFiles = null; +this.sphereNum = 1; +this.cylinderNum = 1; +this.ellipseNum = 1; +this.circleNum = 1; +this.ellipsoidNum = 1; +this.coneNum = 1; +this.triangleNum = 1; +this.surfaceNum = 1; +this.currentVertexOrigin = 1; +this.currentNormalOrigin = 1; +this.currentTextureOrigin = 1; +this.ptTemp = null; +Clazz.instantialize(this, arguments);}, J["export"], "_ObjExporter", J["export"].__CartesianExporter); +Clazz.prepareFields (c$, function(){ +this.textures = new java.util.HashSet(); +this.ptTemp = new JU.P3(); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J["export"]._ObjExporter, []); +this.debugPrint("_WavefrontObjExporter CTOR"); +this.commentChar = "# "; +}); +Clazz.defineMethod(c$, "debugPrint", +function(string){ +if (false) { +JU.Logger.debug(string); +}}, "~S"); +Clazz.overrideMethod(c$, "outputFace", +function(face, map, faceVertexMax){ +}, "~A,~A,~N"); +Clazz.overrideMethod(c$, "outputCircle", +function(pt1, pt2, radius, colix, doFill){ +this.debugPrint("outputCircle"); +if (this.surfacesOnly) { +this.debugPrint(" Not done owing to surfacesOnly"); +return; +}if (doFill) { +this.outputCircle1(pt1, pt2, colix, radius); +}}, "JU.P3,JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputCone", +function(ptBase, ptTip, radius, colix){ +this.debugPrint("outputCone"); +if (this.surfacesOnly) { +this.debugPrint(" Not done owing to surfacesOnly"); +return; +}this.outputCone1(ptBase, ptTip, radius, colix); +}, "JU.P3,JU.P3,~N,~N"); +Clazz.overrideMethod(c$, "outputCylinder", +function(ptCenter, pt1, pt2, colix, endcaps, radius, ptX, ptY, checkRadius){ +if (false) { +this.debugPrint("outputCylinder: colix=" + String.format("%04x", [Short.$valueOf(colix)])); +this.debugPrint(" ptCenter=" + ptCenter); +this.debugPrint(" pt1=" + pt1); +this.debugPrint(" endcaps=" + endcaps + " NONE=" + 0 + " FLAT=" + 2 + " SPHERICAL=" + 3); +this.debugPrint(" radius=" + radius); +this.debugPrint(" pt2=" + pt2); +this.debugPrint(" ptX=" + ptX); +this.debugPrint(" ptY=" + ptY); +}if (this.surfacesOnly) { +this.debugPrint(" Not done owing to surfacesOnly"); +return true; +}if (ptX != null) { +if (endcaps == 2) { +this.outputEllipse1(ptCenter, pt1, ptX, ptY, colix); +this.tempP3.add2(ptCenter, ptCenter); +this.tempP3.sub(ptX); +this.outputEllipse1(ptCenter, pt2, this.tempP3, ptY, colix); +}} else if (endcaps == 3) { +this.outputSphere(pt1, radius * 1.01, colix, true); +this.outputSphere(pt2, radius * 1.01, colix, true); +} else if (endcaps == 2) { +this.outputCircle1(pt1, pt2, colix, radius); +this.outputCircle1(pt2, pt1, colix, radius); +}this.outputCylinder1(ptCenter, pt1, pt2, colix, endcaps, radius, ptX, ptY); +return true; +}, "JU.P3,JU.P3,JU.P3,~N,~N,~N,JU.P3,JU.P3,~B"); +Clazz.overrideMethod(c$, "outputEllipsoid", +function(center, points, colix){ +if (false) { +this.debugPrint("outputEllipsoid: colix=" + String.format("%04x", [Short.$valueOf(colix)])); +this.debugPrint(" center=" + center); +this.debugPrint(" points[0]=" + points[0]); +this.debugPrint(" points[1]=" + points[1]); +this.debugPrint(" points[2]=" + points[2]); +}if (this.surfacesOnly) { +this.debugPrint(" Not done owing to surfacesOnly"); +return; +}var a = JU.Quat.getQuaternionFrame(center, points[1], points[3]).toAxisAngle4f(); +var sx = points[1].distance(center); +var sy = points[3].distance(center); +var sz = points[5].distance(center); +this.outputEllipsoid1(center, sx, sy, sz, a, colix); +}, "JU.P3,~A,~N"); +Clazz.overrideMethod(c$, "outputSphere", +function(center, radius, colix, checkRadius){ +if (false) { +this.debugPrint("outputSphere: colix=" + String.format("%04x", [Short.$valueOf(colix)])); +this.debugPrint(" center.getClass().getName()=" + center.getClass().getName()); +this.debugPrint(" center=" + center); +this.debugPrint(" center.x=" + center.x); +this.debugPrint(" center.y=" + center.y); +this.debugPrint(" center.z=" + center.z); +this.debugPrint(" radius=" + radius); +}if (this.surfacesOnly) { +this.debugPrint(" Not done owing to surfacesOnly"); +return; +}this.outputEllipsoid1(center, radius, radius, radius, null, colix); +}, "JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputTextPixel", +function(pt, argb){ +}, "JU.P3,~N"); +Clazz.overrideMethod(c$, "outputTriangle", +function(pt1, pt2, pt3, colix){ +if (this.surfacesOnly) { +return; +}this.outputTriangle1(pt1, pt2, pt3, colix); +}, "JU.T3,JU.T3,JU.T3,~N"); +Clazz.overrideMethod(c$, "outputHeader", +function(){ +this.debugPrint("outputHeader"); +this.output("#obj Created by Jmol " + JV.Viewer.getJmolVersion() + "\n"); +}); +Clazz.defineMethod(c$, "output", +function(pt){ +this.debugPrint("output"); +}, "JU.T3"); +Clazz.overrideMethod(c$, "drawSurface", +function(meshSurface, colix){ +if (JU.Logger.debugging) { +this.debugPrint("outputSurface"); +this.debugPrint(" nVertices=" + meshSurface.vc); +if (meshSurface.normals == null) { +this.debugPrint(" no vertex normals"); +} else { +this.debugPrint(" nNormals=" + meshSurface.vc); +}if (meshSurface.vcs == null) { +this.debugPrint(" no vertex colors"); +} else { +this.debugPrint(" nColixes=" + meshSurface.vc); +}this.debugPrint(" number of triangles or quads=" + meshSurface.pc); +if (meshSurface.pcs == null) { +this.debugPrint(" no face colors"); +} else { +this.debugPrint(" nPolygonColixes=" + meshSurface.pc); +}if (meshSurface.bsPolygons == null) { +this.debugPrint(" all polygons used"); +} else { +this.debugPrint(" number of polygons used=" + meshSurface.bsPolygons.cardinality()); +}this.debugPrint(" solid color=" + this.gdata.getColorArgbOrGray(colix)); +}var bsPolygons = meshSurface.bsPolygons; +var nPolygons = meshSurface.pc; +if (meshSurface.normals != null) meshSurface.normalCount = meshSurface.vc; +var isAll = (bsPolygons == null); +var faces = JU.AU.newInt2(isAll ? nPolygons : bsPolygons.cardinality()); +var i0 = (isAll ? nPolygons - 1 : bsPolygons.nextSetBit(0)); +for (var i = i0, ipt = 0; i >= 0; i = isAll ? i - 1 : bsPolygons.nextSetBit(i + 1)) { +var polygon = meshSurface.pis[i]; +faces[ipt++] = (meshSurface.haveQuads ? polygon : Clazz.newIntArray(-1, [polygon[0], polygon[1], polygon[2]])); +} +var data = JU.MeshSurface.newMesh(false, meshSurface.vs, meshSurface.vc, faces, meshSurface.normals, 0); +data.vcs = meshSurface.vcs; +var name = "Surface" + this.surfaceNum++; +var isSolidColor = (colix != 0); +this.addTexture(colix, isSolidColor ? null : name); +var dim = null; +if (isSolidColor) { +this.debugPrint("outputSurface: coloring solid"); +this.debugPrint(" Omitting texture map"); +} else { +var nFaces = faces.length; +var width = Clazz.doubleToInt(Math.ceil(Math.sqrt(nFaces))); +var height = Clazz.doubleToInt(nFaces / width); +if (nFaces % width != 0) { +height++; +}dim = Clazz.newIntArray(-1, [width, height]); +this.debugPrint(" width=" + width + " height=" + height + " size = " + (width * height)); +var file = this.createTextureFile(name, data, dim); +if (file == null || file.getByteCount() == 0) { +System.out.println("Error creating texture file: " + name); +this.textureFiles.addLast("Error creating texture file: " + name); +return; +}this.textureFiles.addLast(file.getByteCount() + " (" + width + "x" + height + ") " + name); +var shortName = file.getName(); +this.outputMtl(" map_Kd " + shortName + "\n"); +this.outputMtl(" map_Ka " + shortName + "\n"); +}var matrix = JU.M4.newM4(null); +matrix.setTranslation(JU.V3.newV(meshSurface.offset)); +var bsValid = new JU.BS(); +this.addMesh(name, data, matrix, null, colix, dim, bsValid); +}, "JU.MeshSurface,~N"); +Clazz.overrideMethod(c$, "initializeOutput", +function(vwr, privateKey, gdata, params){ +this.debugPrint("initializeOutput: + output"); +var retVal = this.initOutput(vwr, privateKey, gdata, params); +if (!retVal) { +this.debugPrint("End initializeOutput (error in super):"); +return false; +}if (this.fileName == null) { +throw new NullPointerException("Cannot output two files (OBJ and MTL) to string"); +}var dot = this.fileName.lastIndexOf("."); +if (dot < 0) { +this.debugPrint("End initializeOutput (Error creating .mtl file):"); +return false; +}this.objFileRootName = this.fileName.substring(0, dot); +try { +var mtlFileName = this.objFileRootName + ".mtl"; +this.mtlout = vwr.openExportChannel(privateKey, mtlFileName, true); +} catch (ex) { +if (Clazz.exceptionOf(ex, Exception)){ +this.debugPrint("End initializeOutput (" + ex.getMessage() + "):"); +return false; +} else { +throw ex; +} +} +this.outputMtl("# Created by Jmol " + JV.Viewer.getJmolVersion() + "\n"); +this.output("\nmtllib " + this.mtlout.getName() + "\n"); +this.textureFiles = new JU.Lst(); +this.debugPrint("End initializeOutput:"); +return true; +}, "JV.Viewer,~N,JU.GData,java.util.Map"); +Clazz.overrideMethod(c$, "finalizeOutput", +function(){ +this.debugPrint("finalizeOutput"); +var retVal = this.finalizeOutput2(); +var ret = this.mtlout.closeChannel(); +if (ret != null) { +JU.Logger.info(ret); +ret = "ERROR EXPORTING MTL FILE: " + ret; +if (retVal.startsWith("OK")) return ret; +return retVal + " and " + ret; +}retVal += ", " + this.nMtlBytes + " " + this.mtlout.getFileName(); +for (var string, $string = this.textureFiles.iterator (); $string.hasNext()&& ((string = $string.next ()) || true);) { +retVal += ", " + string; +} +this.debugPrint(retVal); +this.debugPrint("End finalizeOutput:"); +return retVal; +}); +Clazz.defineMethod(c$, "outputMtl", +function(data){ +this.nMtlBytes += data.length; +this.mtlout.append(data); +}, "~S"); +Clazz.defineMethod(c$, "getTextureName", +function(colix){ +return "k" + JU.Escape.getHexColorFromRGB(this.gdata.getColorArgbOrGray(colix)); +}, "~N"); +Clazz.defineMethod(c$, "outputCircle1", +function(ptCenter, ptPerp, colix, radius){ +var data = J["export"].MeshData.getCircleData(); +var matrix = new JU.M4(); +this.addTexture(colix, null); +var name = "Circle" + this.circleNum++; +matrix.setToM3(this.getRotationMatrix(ptCenter, ptPerp, radius)); +matrix.m03 = ptCenter.x; +matrix.m13 = ptCenter.y; +matrix.m23 = ptCenter.z; +matrix.m33 = 1; +this.addMesh(name, data, matrix, matrix, colix, null, null); +}, "JU.P3,JU.P3,~N,~N"); +Clazz.defineMethod(c$, "outputCone1", +function(ptBase, ptTip, radius, colix){ +var data = J["export"].MeshData.getConeData(); +var matrix = new JU.M4(); +this.addTexture(colix, null); +var name = "Cone" + this.coneNum++; +matrix.setToM3(this.getRotationMatrix(ptBase, ptTip, radius)); +matrix.m03 = ptBase.x; +matrix.m13 = ptBase.y; +matrix.m23 = ptBase.z; +matrix.m33 = 1; +this.addMesh(name, data, matrix, matrix, colix, null, null); +}, "JU.P3,JU.P3,~N,~N"); +Clazz.defineMethod(c$, "outputEllipse1", +function(ptCenter, ptZ, ptX, ptY, colix){ +var data = J["export"].MeshData.getCircleData(); +var matrix = new JU.M4(); +this.addTexture(colix, null); +var name = "Ellipse" + this.ellipseNum++; +matrix.setToM3(this.getRotationMatrix(ptCenter, ptZ, 1, ptX, ptY)); +matrix.m03 = ptZ.x; +matrix.m13 = ptZ.y; +matrix.m23 = ptZ.z; +matrix.m33 = 1; +this.addMesh(name, data, matrix, matrix, colix, null, null); +return true; +}, "JU.P3,JU.P3,JU.P3,JU.P3,~N"); +Clazz.defineMethod(c$, "outputEllipsoid1", +function(center, rx, ry, rz, a, colix){ +var data = JU.MeshSurface.getSphereData(3); +this.addTexture(colix, null); +var name; +if (Clazz.instanceOf(center,"JM.Atom")) { +var atom = center; +name = JU.PT.replaceAllCharacters(atom.getAtomName(), " \t", "") + "_Atom"; +} else if (rx == ry && rx == rz) { +name = "Sphere" + this.sphereNum++; +} else { +name = "Ellipsoid" + this.ellipsoidNum++; +}this.setSphereMatrix(center, rx, ry, rz, a, this.sphereMatrix); +this.addMesh(name, data, this.sphereMatrix, this.sphereMatrix, colix, null, null); +}, "JU.T3,~N,~N,~N,JU.A4,~N"); +Clazz.defineMethod(c$, "outputCylinder1", +function(ptCenter, pt1, pt2, colix, endcaps, radius, ptX, ptY){ +var data = J["export"].MeshData.getCylinderData(false); +var matrix = new JU.M4(); +this.addTexture(colix, null); +var name = "Cylinder" + this.cylinderNum++; +var n = (ptX != null && endcaps == 0 ? 2 : 1); +for (var i = 0; i < n; i++) { +if (ptX == null) matrix.setToM3(this.getRotationMatrix(pt1, pt2, radius)); + else matrix.setToM3(this.getRotationMatrix(ptCenter, pt2, radius, ptX, ptY)); +matrix.m03 = pt1.x; +matrix.m13 = pt1.y; +matrix.m23 = pt1.z; +matrix.m33 = 1; +} +this.addMesh(name, data, matrix, matrix, colix, null, null); +}, "JU.P3,JU.P3,JU.P3,~N,~N,~N,JU.P3,JU.P3"); +Clazz.defineMethod(c$, "outputTriangle1", +function(pt1, pt2, pt3, colix){ +var data = J["export"].MeshData.getTriangleData(pt1, pt2, pt3); +this.addTexture(colix, null); +var name = "Triangle" + this.triangleNum++; +var matrix = JU.M4.newM4(null); +this.addMesh(name, data, matrix, matrix, colix, null, null); +}, "JU.T3,JU.T3,JU.T3,~N"); +Clazz.defineMethod(c$, "addTexture", +function(colix, name){ +var scolix = Short.$valueOf(colix); +if (name == null && this.textures.contains(scolix)) { +return; +}this.textures.add(scolix); +var sb = new JU.SB(); +sb.append("\nnewmtl " + (name == null ? this.getTextureName(colix) : name) + "\n"); +sb.append(" Ns 163\n"); +sb.append(" Tr " + J["export"].___Exporter.opacityFractionalFromColix(colix) + "\n"); +sb.append(" Ni 0.001\n"); +sb.append(" illum 2\n"); +sb.append(" Ka 0.20 0.20 0.20\n"); +sb.append(" Kd " + this.rgbFractionalFromColix(colix) + "\n"); +sb.append(" Ks 0.25 0.25 0.25\n"); +this.outputMtl(sb.toString()); +}, "~N,~S"); +Clazz.defineMethod(c$, "addMesh", +function(name, data, matrix, matrix1, colix, dim, bsValid){ +if (this.surfacesOnly) { +if (name == null || !name.startsWith("Surface")) { +return; +}}this.output("\ng " + name + "\n"); +this.output("usemtl " + (dim == null ? this.getTextureName(colix) : name) + "\n"); +var faces = data.getFaces(); +var nFaces = faces.length; +if (bsValid != null) for (var face, $face = 0, $$face = faces; $face < $$face.length && ((face = $$face[$face]) || true); $face++) for (var i, $i = 0, $$i = face; $i < $$i.length && ((i = $$i[$i]) || true); $i++) bsValid.set(i); + + +var vertices = data.getVertices(); +var nVertices = data.vc; +var map = Clazz.newIntArray (nVertices, 0); +var nCoord = this.getCoordinateMap(vertices, map, bsValid); +this.output("# Number of vertices: " + nCoord + "\n"); +this.outputList(vertices, nVertices, matrix, "v ", bsValid); +nVertices = nCoord; +var normals = data.normals; +var nNormals = data.normalCount; +var map2 = null; +var vNormals = null; +if (normals != null) { +vNormals = new JU.Lst(); +map2 = this.getNormalMap(normals, nNormals, bsValid, vNormals); +nNormals = vNormals.size(); +this.output("# Number of normals: " + nNormals + "\n"); +for (var i = 0; i < nNormals; i++) this.output("vn " + vNormals.get(i)); + +}if (dim != null) { +this.output("# Number of texture coordinates: " + nFaces + "\n"); +var width = dim[0]; +var height = dim[1]; +var u; +var v; +for (var row = 0, iFace = 0; row < height; row++) { +v = row + .5; +if (this.normalizeUV) v /= height; +for (var col = 0; col < width; col++) { +u = col + .5; +if (this.normalizeUV) u /= width; +this.output("vt " + u + " " + v + "\n"); +if (++iFace == nFaces) break; +} +} +if (!this.normalizeUV) { +this.output("vt 0.0 0.0\n"); +this.output("vt " + width + " " + height + "\n"); +}}this.output("# Number of faces: " + nFaces + "\n"); +for (var i = 0; i < nFaces; i++) if (dim != null) this.outputFace2(faces[i], i, map, map2); + else this.outputFace1(faces[i], map, map2); + +if (dim != null) this.currentTextureOrigin += nFaces; +this.currentVertexOrigin += nVertices; +this.currentNormalOrigin += nNormals; +}, "~S,JU.MeshSurface,JU.M4,JU.M4,~N,~A,JU.BS"); +Clazz.defineMethod(c$, "outputList", +function(pts, nPts, m, prefix, bsValid){ +for (var i = 0; i < nPts; i++) { +if (bsValid != null && !bsValid.get(i)) continue; +this.ptTemp.setT(pts[i]); +if (m != null) m.rotTrans(this.ptTemp); +this.output(prefix + this.ptTemp.x + " " + this.ptTemp.y + " " + this.ptTemp.z + "\n"); +} +}, "~A,~N,JU.M4,~S,JU.BS"); +Clazz.defineMethod(c$, "outputFace1", +function(face, map, map2){ +this.output("f"); +for (var i, $i = 0, $$i = face; $i < $$i.length && ((i = $$i[$i]) || true); $i++) this.output(" " + ((map == null ? i : map[i]) + this.currentVertexOrigin) + "//" + ((map2 == null ? i : map2[i]) + this.currentNormalOrigin)); + +this.output("\n"); +}, "~A,~A,~A"); +Clazz.defineMethod(c$, "outputFace2", +function(face, vt, map, map2){ +this.output("f"); +for (var i, $i = 0, $$i = face; $i < $$i.length && ((i = $$i[$i]) || true); $i++) { +this.output(" " + ((map == null ? i : map[i]) + this.currentVertexOrigin) + "/" + (this.currentTextureOrigin + vt) + "/" + ((map2 == null ? i : map2[i]) + this.currentNormalOrigin)); +} +this.output("\n"); +}, "~A,~N,~A,~A"); +Clazz.defineMethod(c$, "createTextureFile", +function(name, data, dim){ +this.debugPrint("createTextureFile: " + name); +var colixes = (data.pcs == null ? data.vcs : data.pcs); +if (colixes == null || colixes.length == 0) { +this.debugPrint("createTextureFile: Array problem"); +this.debugPrint(" colixes=" + colixes + " data=" + data); +if (colixes != null) { +this.debugPrint(" colixes.length=" + colixes.length); +}return null; +}var nUsed = data.pis.length; +if (nUsed <= 0) { +this.debugPrint("createTextureFile: nFaces = 0"); +return null; +}var width = dim[0]; +var height = dim[1]; +var textureType = "png"; +var row = height - 1; +var col = 0; +var sum = new JU.P3(); +var w = width * 3; +var h = height * 3; +var bytes = (textureType.equals("tga") ? Clazz.newByteArray (h, w * 3, 0) : null); +var rgbbuf = (bytes == null ? Clazz.newIntArray (h * w, 0) : null); +var ptTemp = new JU.P3(); +for (var i = 0; i < data.pis.length; i++) { +var rgb; +if (data.pcs == null) { +var face = data.pis[i]; +sum.set(0, 0, 0); +for (var iVertex, $iVertex = 0, $$iVertex = face; $iVertex < $$iVertex.length && ((iVertex = $$iVertex[$iVertex]) || true); $iVertex++) sum.add(JU.CU.colorPtFromInt(this.gdata.getColorArgbOrGray(colixes[iVertex]), ptTemp)); + +sum.scale(1.0 / face.length); +rgb = JU.CU.colorPtToFFRGB(sum); +} else { +rgb = this.gdata.getColorArgbOrGray(colixes[i]); +}if (bytes == null) { +for (var j = 0; j < 3; j++) for (var k = 0; k < 3; k++) rgbbuf[(row * 3 + k) * w + col * 3 + j] = rgb; + + +} else { +}if ((col = (col + 1) % width) == 0) row--; +} +try { +var params = new java.util.Hashtable(); +var fname = this.fileName; +if (rgbbuf != null) { +params.put("rgbbuf", rgbbuf); +params.put("fileName", this.objFileRootName + "_" + name + "." + textureType); +params.put("type", textureType); +params.put("width", Integer.$valueOf(w)); +params.put("height", Integer.$valueOf(h)); +fname = this.fileName = this.vwr.outputToFile(params); +}this.debugPrint("End createTextureFile: " + fname); +return params.get("outputChannel"); +} catch (ex) { +if (Clazz.exceptionOf(ex, Exception)){ +this.debugPrint("End createTextureFile (" + ex.getMessage() + "):"); +return null; +} else { +throw ex; +} +} +}, "~S,JU.MeshSurface,~A"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/_PovrayExporter.js b/config/plugins/visualizations/jmol/static/j2s/J/export/_PovrayExporter.js new file mode 100755 index 000000000000..f6d4429e9d4c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/_PovrayExporter.js @@ -0,0 +1,245 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["J.export.__RayTracerExporter"], "J.export._PovrayExporter", ["JU.Measure", "$.P4", "JV.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.haveMacros = false; +Clazz.instantialize(this, arguments);}, J["export"], "_PovrayExporter", J["export"].__RayTracerExporter); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J["export"]._PovrayExporter, []); +this.commentChar = "// "; +}); +Clazz.overrideMethod(c$, "finalizeOutput", +function(){ +this.finalizeOutput2(); +return this.getAuxiliaryFileData(); +}); +Clazz.overrideMethod(c$, "outputHeader", +function(){ +this.initVars(); +this.output("// ******************************************************\n"); +this.output("// Created by Jmol " + JV.Viewer.getJmolVersion() + "\n"); +this.output("//\n"); +this.output("// This script was generated on " + this.getExportDate() + "\n"); +this.output("// ******************************************************\n"); +try { +this.output(this.vwr.getWrappedStateScript()); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +this.output("\n"); +this.output(this.getJmolPerspective()); +this.output("\n"); +this.output("// ******************************************************\n"); +this.output("// Declare the resolution, camera, and light sources.\n"); +this.output("// ******************************************************\n"); +this.output("\n"); +this.output("// NOTE: if you plan to render at a different resolution,\n"); +this.output("// be sure to update the following two lines to maintain\n"); +this.output("// the correct aspect ratio.\n\n"); +this.output("#declare Width = " + this.screenWidth + ";\n"); +this.output("#declare Height = " + this.screenHeight + ";\n"); +this.output("#declare minScreenDimension = " + this.minScreenDimension + ";\n"); +this.output("#declare showAtoms = true;\n"); +this.output("#declare showBonds = true;\n"); +this.output("#declare noShadows = true;\n"); +this.output("camera{\n"); +var offsetX; +var offsetY; +var f; +if (this.wasPerspective) { +offsetX = this.vwr.tm.getTranslationXPercent() / 100 * this.screenWidth; +offsetY = this.vwr.tm.getTranslationYPercent() / 100 * this.screenHeight; +f = 1 / this.vwr.tm.getPerspectiveFactor((this.vwr.tm.getCameraDepth() - 0.5) * this.vwr.getScreenDim()); +this.output(" perspective\n"); +this.output(" angle " + this.apertureAngle + "\n"); +this.output(" right < " + this.screenWidth + ", 0, 0>\n"); +this.output(" up < 0, " + -this.screenHeight + ", 0 >\n"); +} else { +offsetX = offsetY = f = 0; +this.output(" orthographic\n"); +this.output(" right < " + -this.screenWidth + ", 0, 0>\n"); +this.output(" up < 0, " + this.screenHeight + ", 0 >\n"); +}this.output(" sky < 0, -1, 0 >\n"); +this.output(" location < " + (this.screenWidth / 2 + offsetX) + ", " + (this.screenHeight / 2 + offsetY) + ", 0>\n"); +this.output(" look_at < " + (this.screenWidth / 2 + f * offsetX) + ", " + (this.screenHeight / 2 + f * offsetY) + ", 1000 >\n"); +this.output("}\n"); +this.output("\n"); +this.output("background { color rgb <" + this.rgbFractionalFromColix(this.backgroundColix) + "> }\n"); +this.output("\n"); +var distance = Math.max(this.screenWidth, this.screenHeight); +this.output("light_source { <" + this.lightSource.x * distance + "," + this.lightSource.y * distance + ", " + (-1 * this.lightSource.z * distance) + "> " + " rgb <0.6,0.6,0.6> }\n"); +this.output("\n"); +this.output("\n"); +this.output("// ***********************************************\n"); +this.output("// macros for common shapes\n"); +this.output("// ***********************************************\n"); +this.output("\n"); +this.writeMacros(); +}); +Clazz.defineMethod(c$, "writeMacros", +function(){ +this.output("#default { finish {\n" + " ambient " + this.gdata.getAmbientPercent() / 100 + "\n" + " diffuse " + this.gdata.getDiffusePercent() / 100 + "\n" + " specular " + this.gdata.getSpecularPercent() / 100 + "\n" + " roughness .00001\n metallic\n phong 0.9\n phong_size 120\n}}" + "\n\n"); +this.output("#macro check_shadow()\n #if (noShadows)\n no_shadow \n #end\n#end\n\n"); +this.output("#declare slabZ = " + this.slabZ + ";\n" + "#declare depthZ = " + this.depthZ + ";\n" + "#declare dzSlab = 10;\n" + "#declare dzDepth = dzSlab;\n" + "#declare dzStep = 0.001;\n\n"); +this.output("#macro clip()\n clipped_by { box {<0,0,slabZ>,} }\n#end\n\n"); +this.output("#macro circleCap(Z,RADIUS,R,G,B,T)\n// cap for lower clip\n #local cutDiff = Z - slabZ;\n #local cutRadius2 = (RADIUS*RADIUS) - (cutDiff*cutDiff);\n #if (cutRadius2 > 0)\n #local cutRadius = sqrt(cutRadius2);\n #if (dzSlab > 0)\n #declare dzSlab = dzSlab - dzStep;\n #end\n cylinder{ , ,cutRadius\n pigment{rgbt }\n translucentFinish(T)\n check_shadow()}\n #end\n// cap for upper clip\n #declare cutDiff = Z - depthZ;\n #declare cutRadius2 = (RADIUS*RADIUS) - (cutDiff*cutDiff);\n #if (cutRadius2 > 0)\n #local cutRadius = sqrt(cutRadius2);\n #if (dzDepth > 0)\n #declare dzDepth = dzDepth - dzStep;\n #end\n cylinder{ , ,cutRadius\n pigment{rgbt }\n translucentFinish(T)\n check_shadow()}\n #end\n#end\n\n"); +this.writeMacrosFinish(); +this.writeMacrosAtom(); +this.writeMacrosBond(); +}); +Clazz.defineMethod(c$, "writeMacrosFinish", +function(){ +this.output("#macro translucentFinish(T)\n" + " #local shineFactor = T;\n" + " #if (T <= 0.25)\n" + " #declare shineFactor = (1.0-4*T);\n" + " #end\n" + " #if (T > 0.25)\n" + " #declare shineFactor = 0;\n" + " #end\n" + " finish {\n" + " ambient " + this.gdata.getAmbientPercent() / 100 + "\n" + " diffuse " + this.gdata.getDiffusePercent() / 100 + "\n" + " specular " + this.gdata.getSpecularPercent() / 100 + "\n" + " roughness .00001\n" + " metallic shineFactor\n" + " phong 0.9*shineFactor\n" + " phong_size 120*shineFactor\n}" + "#end\n\n"); +}); +Clazz.defineMethod(c$, "writeMacrosAtom", +function(){ +this.output("#macro a(X,Y,Z,RADIUS,R,G,B,T)\n sphere{ ,RADIUS\n pigment{rgbt }\n translucentFinish(T)\n clip()\n check_shadow()}\n" + (this.isSlabEnabled ? " circleCap(Z,RADIUS,R,G,B,T)\n" : "") + "#end\n\n"); +this.output("#macro q(XX,YY,ZZ,XY,XZ,YZ,X,Y,Z,J,R,G,B,T)\n quadric{ , , ,J\n pigment{rgbt }\n translucentFinish(T)\n clip()\n check_shadow()}\n#end\n\n"); +}); +Clazz.defineMethod(c$, "writeMacrosBond", +function(){ +this.output("#macro b(X1,Y1,Z1,RADIUS1,X2,Y2,Z2,RADIUS2,R,G,B,T)\n cone{ ,RADIUS1, ,RADIUS2\n pigment{rgbt }\n translucentFinish(T)\n clip()\n check_shadow()}\n#end\n\n"); +this.output("#macro c(X1,Y1,Z1,RADIUS1,X2,Y2,Z2,RADIUS2,R,G,B,T)\n cone{ ,RADIUS1, ,RADIUS2 open\n pigment{rgbt }\n translucentFinish(T)\n clip()\n check_shadow()}\n#end\n\n"); +}); +Clazz.defineMethod(c$, "writeMacros2", +function(){ +this.output("#macro r(X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3,R,G,B,T)\n triangle{ , , \n pigment{rgbt }\n translucentFinish(T)\n clip()\n check_shadow()}\n#end\n\n"); +this.output("#macro p(X,Y,Z,R,G,B,T)\n box{ , \n pigment{rgbt }\n clip()\n check_shadow()}\n#end\n\n"); +this.output("#macro barb(X1,Y1,Z1,RADIUS1,X2,Y2,Z2,RADIUS2,R,G,B,T,X3,Y3,Z3,W3)\n cone{ ,RADIUS1, ,RADIUS2\n pigment{rgbt }\n translucentFinish(T)\n clip()\n clipped_by{plane{ ,W3}}\n check_shadow()}\n#end\n\n"); +this.haveMacros = true; +}); +Clazz.defineMethod(c$, "getTriad", +function(pt){ +if (Float.isNaN(pt.x)) return "0,0,0"; +return pt.x + "," + pt.y + "," + pt.z; +}, "JU.T3"); +Clazz.defineMethod(c$, "getTriad", +function(i){ +return i[0] + "," + i[1] + "," + i[2]; +}, "~A"); +Clazz.defineMethod(c$, "color4", +function(colix){ +return this.rgbFractionalFromColix(colix) + "," + J["export"].___Exporter.translucencyFractionalFromColix(colix); +}, "~N"); +Clazz.defineMethod(c$, "getAuxiliaryFileData", +function(){ +var fName = this.fileName.substring(this.fileName.lastIndexOf("/") + 1); +fName = fName.substring(fName.lastIndexOf("\\") + 1); +return "; Created by: Jmol " + JV.Viewer.getJmolVersion() + "\n; Creation date: " + this.getExportDate() + "\n; File created: " + this.fileName + " (" + this.getByteCount() + " bytes)\n\n" + (this.commandLineOptions != null ? this.commandLineOptions : "\n; Jmol state: (embedded in input file)\nInput_File_Name=" + fName + "\nOutput_to_File=true" + "\nOutput_File_Type=N" + "\nOutput_File_Name=" + fName + ".png" + "\nWidth=" + this.screenWidth + "\nHeight=" + this.screenHeight + "\nAntialias=true" + "\nAntialias_Threshold=0.1" + "\nDisplay=true" + "\nPause_When_Done=true" + "\nWarning_Level=5" + "\nVerbose=false" + "\n"); +}); +Clazz.defineMethod(c$, "output", +function(pt){ +this.output(", <" + this.getTriad(pt) + ">"); +}, "JU.T3"); +Clazz.overrideMethod(c$, "outputCircle", +function(x, y, z, radius, colix, doFill){ +this.output((doFill ? "b(" : "c(") + x + "," + y + "," + z + "," + radius + "," + x + "," + y + "," + (z + 1) + "," + (radius + (doFill ? 0 : 2)) + "," + this.color4(colix) + ")\n"); +}, "~N,~N,~N,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputCone", +function(screenBase, screenTip, radius, colix, isBarb){ +if (isBarb) { +if (!this.haveMacros) this.writeMacros2(); +this.tempP1.set(screenBase.x, screenTip.y, 12345.6789); +var plane = JU.Measure.getPlaneThroughPoints(screenBase, screenTip, this.tempP1, this.tempV1, this.tempV2, new JU.P4()); +this.output("barb(" + this.getTriad(screenBase) + "," + radius + "," + this.getTriad(screenTip) + ",0" + "," + this.color4(colix) + "," + plane.x + "," + plane.y + "," + plane.z + "," + -plane.w + ")\n"); +} else { +this.output("b(" + this.getTriad(screenBase) + "," + radius + "," + this.getTriad(screenTip) + ",0" + "," + this.color4(colix) + ")\n"); +}}, "JU.P3,JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputCylinder", +function(screenA, screenB, radius, colix, withCaps){ +var color = this.color4(colix); +this.output((withCaps ? "b(" : "c(") + this.getTriad(screenA) + "," + radius + "," + this.getTriad(screenB) + "," + radius + "," + color + ")\n"); +}, "JU.P3,JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputCylinderConical", +function(screenA, screenB, radius1, radius2, colix){ +this.output("b(" + this.getTriad(screenA) + "," + radius1 + "," + this.getTriad(screenB) + "," + radius2 + "," + this.color4(colix) + ")\n"); +}, "JU.P3,JU.P3,~N,~N,~N"); +Clazz.overrideMethod(c$, "outputEllipsoid", +function(center, radius, coef, colix){ +var s = coef[0] + "," + coef[1] + "," + coef[2] + "," + coef[3] + "," + coef[4] + "," + coef[5] + "," + coef[6] + "," + coef[7] + "," + coef[8] + "," + coef[9] + "," + this.color4(colix); +this.output("q(" + s + ")\n"); +}, "JU.P3,~N,~A,~N"); +Clazz.overrideMethod(c$, "outputSurface", +function(vertices, normals, colixes, indices, polygonColixes, nVertices, nPolygons, nTriangles, bsPolygons, faceVertexMax, colix, colorList, htColixes, offset){ +if (polygonColixes != null) { +var isAll = (bsPolygons == null); +var i0 = (isAll ? nPolygons - 1 : bsPolygons.nextSetBit(0)); +for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsPolygons.nextSetBit(i + 1))) { +this.output("polygon { 4\n"); +for (var j = 0; j <= 3; j++) this.outputVertex(vertices[indices[i][j % 3]], offset); + +this.output("\n"); +this.output("pigment{rgbt<" + this.color4(colix = polygonColixes[i]) + ">}\n"); +this.output(" translucentFinish(" + J["export"].___Exporter.translucencyFractionalFromColix(colix) + ")\n"); +this.output(" check_shadow()\n"); +this.output(" clip()\n"); +this.output("}\n"); +} +return; +}this.output("mesh2 {\n"); +this.output("vertex_vectors { " + nVertices); +for (var i = 0; i < nVertices; i++) this.outputVertex(vertices[i], offset); + +this.output("\n}\n"); +var haveNormals = (normals != null); +if (haveNormals) { +this.output("normal_vectors { " + nVertices); +for (var i = 0; i < nVertices; i++) { +J["export"].___Exporter.setTempVertex(vertices[i], offset, this.tempP2); +this.output(this.getScreenNormal(this.tempP2, normals[i], 1)); +this.output("\n"); +} +this.output("\n}\n"); +}if (colixes != null) { +var nColix = colorList.size(); +this.output("texture_list { " + nColix); +var finish = ">} translucentFinish(" + J["export"].___Exporter.translucencyFractionalFromColix(colixes[0]) + ")}"; +for (var i = 0; i < nColix; i++) this.output("\n, texture{pigment{rgbt<" + this.color4(colorList.get(i).shortValue()) + finish); + +this.output("\n}\n"); +}this.output("face_indices { " + nTriangles); +var isAll = (bsPolygons == null); +var i0 = (isAll ? nPolygons - 1 : bsPolygons.nextSetBit(0)); +for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsPolygons.nextSetBit(i + 1))) { +this.output(", <" + this.getTriad(indices[i]) + ">"); +if (colixes != null) { +this.output("," + htColixes.get(Short.$valueOf(colixes[indices[i][0]]))); +this.output("," + htColixes.get(Short.$valueOf(colixes[indices[i][1]]))); +this.output("," + htColixes.get(Short.$valueOf(colixes[indices[i][2]]))); +}if (faceVertexMax == 4 && indices[i].length == 4) { +this.output(", <" + indices[i][0] + "," + indices[i][2] + "," + indices[i][3] + ">"); +if (colixes != null) { +this.output("," + htColixes.get(Short.$valueOf(colixes[indices[i][0]]))); +this.output("," + htColixes.get(Short.$valueOf(colixes[indices[i][2]]))); +this.output("," + htColixes.get(Short.$valueOf(colixes[indices[i][3]]))); +}}this.output("\n"); +} +this.output("\n}\n"); +if (colixes == null) { +this.output("pigment{rgbt<" + this.color4(colix) + ">}\n"); +this.output(" translucentFinish(" + J["export"].___Exporter.translucencyFractionalFromColix(colix) + ")\n"); +}this.output(" check_shadow()\n"); +this.output(" clip()\n"); +this.output("}\n"); +}, "~A,~A,~A,~A,~A,~N,~N,~N,JU.BS,~N,~N,JU.Lst,java.util.Map,JU.P3"); +Clazz.overrideMethod(c$, "outputSphere", +function(x, y, z, radius, colix){ +this.output("a(" + x + "," + y + "," + z + "," + radius + "," + this.color4(colix) + ")\n"); +}, "~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "outputTextPixel", +function(x, y, z, argb){ +if (!this.haveMacros) this.writeMacros2(); +var tr = ((argb >> 24) & 0xFF); +tr = (255 - tr) / 255; +this.output("p(" + x + "," + y + "," + z + "," + this.rgbFractionalFromArgb(argb) + "," + tr + ")\n"); +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "outputTriangle", +function(ptA, ptB, ptC, colix){ +if (!this.haveMacros) this.writeMacros2(); +this.output("r(" + this.getTriad(ptA) + "," + this.getTriad(ptB) + "," + this.getTriad(ptC) + "," + this.color4(colix) + ")\n"); +}, "JU.T3,JU.T3,JU.T3,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/_StlExporter.js b/config/plugins/visualizations/jmol/static/j2s/J/export/_StlExporter.js new file mode 100755 index 000000000000..d117ec8d3bff --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/_StlExporter.js @@ -0,0 +1,147 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["J.export._VrmlExporter", "JU.M4"], "J.export._StlExporter", ["java.io.ByteArrayOutputStream", "JU.Lst", "$.Measure", "$.OC", "JU.Logger", "JV.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.isDebug = false; +this.header = null; +this.oc = null; +this.bos = null; +this.m4 = null; +this.lstMatrix = null; +this.m4a = null; +this.nTri = 0; +Clazz.instantialize(this, arguments);}, J["export"], "_StlExporter", J["export"]._VrmlExporter); +Clazz.prepareFields (c$, function(){ +this.m4a = new JU.M4(); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor(this, J["export"]._StlExporter); +this.useTable = null; +this.lineWidthMad = 20; +this.noColor = true; +this.isDebug = JU.Logger.debugging; +if (!this.isDebug) { +this.oc = new JU.OC(); +this.oc.setBigEndian(false); +this.oc.setParams(null, null, false, this.bos = new java.io.ByteArrayOutputStream()); +}}); +Clazz.overrideMethod(c$, "outputHeader", +function(){ +this.header = ("solid model generated by Jmol " + JV.Viewer.getJmolVersion() + " ").substring(0, 80); +if (this.isDebug) { +this.out.append(this.header); +this.out.append("\n"); +} else { +this.oc.write(this.header.getBytes(), 0, 80); +this.oc.write( Clazz.newByteArray (4, 0), 0, 4); +}this.lstMatrix = new JU.Lst(); +this.m4 = new JU.M4(); +this.m4.setIdentity(); +this.lstMatrix.addLast(this.m4); +this.outputInitialTransform(); +}); +Clazz.overrideMethod(c$, "pushMatrix", +function(){ +this.lstMatrix.addLast(this.m4); +this.m4 = JU.M4.newM4(this.m4); +}); +Clazz.overrideMethod(c$, "popMatrix", +function(){ +this.m4 = this.lstMatrix.removeItemAt(this.lstMatrix.size() - 1); +}); +Clazz.defineMethod(c$, "output", +function(data){ +}, "~S"); +Clazz.overrideMethod(c$, "outputChildStart", +function(){ +}); +Clazz.overrideMethod(c$, "outputChildClose", +function(){ +}); +Clazz.overrideMethod(c$, "outputRotation", +function(a){ +this.m4a.setToAA(a); +this.m4.mul(this.m4a); +}, "JU.A4"); +Clazz.overrideMethod(c$, "outputAttrPt", +function(attr, pt){ +this.outputAttr(attr, pt.x, pt.y, pt.z); +}, "~S,JU.T3"); +Clazz.overrideMethod(c$, "outputAttr", +function(attr, x, y, z){ +this.m4a.setIdentity(); +if (attr === "scale") { +this.m4a.m00 = x; +this.m4a.m11 = y; +this.m4a.m22 = z; +} else if (attr === "translation") { +this.m4a.m03 = x; +this.m4a.m13 = y; +this.m4a.m23 = z; +}this.m4.mul(this.m4a); +}, "~S,~N,~N,~N"); +Clazz.overrideMethod(c$, "outputGeometry", +function(vertices, normals, colixes, indices, polygonColixes, nVertices, nPolygons, bsPolygons, faceVertexMax, colorList, htColixes, offset){ +for (var i = 0; i < nPolygons; i++) { +if (bsPolygons != null && !bsPolygons.get(i)) continue; +var face = indices[i]; +this.writeFacet(vertices, face, 0, 1, 2); +if (faceVertexMax == 4 && face.length >= 4 && face[2] != face[3]) this.writeFacet(vertices, face, 2, 3, 0); +} +}, "~A,~A,~A,~A,~A,~N,~N,JU.BS,~N,JU.Lst,java.util.Map,JU.P3"); +Clazz.defineMethod(c$, "writeFacet", +function(vertices, face, i, j, k){ +this.tempQ1.setT(vertices[face[i]]); +this.tempQ2.setT(vertices[face[j]]); +this.tempQ3.setT(vertices[face[k]]); +this.m4.rotTrans(this.tempQ1); +this.m4.rotTrans(this.tempQ2); +this.m4.rotTrans(this.tempQ3); +JU.Measure.calcNormalizedNormal(this.tempQ1, this.tempQ2, this.tempQ3, this.tempV1, this.tempV2); +if (Float.isNaN(this.tempV1.x)) { +return; +}this.writePoint("facet normal", this.tempV1); +this.writePoint("outer loop\nvertex", this.tempQ1); +this.writePoint("vertex", this.tempQ2); +this.writePoint("vertex", this.tempQ3); +if (this.isDebug) { +this.out.append("endloop\nendfacet\n"); +} else { +this.oc.writeByteAsInt(0); +this.oc.writeByteAsInt(0); +}this.nTri++; +}, "~A,~A,~N,~N,~N"); +Clazz.overrideMethod(c$, "finalizeOutput", +function(){ +if (this.isDebug) { +this.out.append("endsolid model\n"); +} else { +var b = this.bos.toByteArray(); +b[80] = (this.nTri & 0xff); +b[81] = ((this.nTri >> 8) & 0xff); +b[82] = ((this.nTri >> 16) & 0xff); +b[83] = ((this.nTri >> 24) & 0xff); +this.out.write(b, 0, b.length); +}return this.finalizeOutput2(); +}); +Clazz.overrideMethod(c$, "outputCircle", +function(pt1, pt2, radius, colix, doFill){ +}, "JU.P3,JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "plotText", +function(x, y, z, colix, text, font3d){ +}, "~N,~N,~N,~N,~S,JU.Font"); +Clazz.defineMethod(c$, "writePoint", +function(s, p){ +if (this.isDebug) this.out.append(s); +this.writeFloat(p.x); +this.writeFloat(p.y); +this.writeFloat(p.z); +if (this.isDebug) this.out.append("\n"); +}, "~S,JU.T3"); +Clazz.defineMethod(c$, "writeFloat", +function(f){ +if (this.isDebug) this.out.append(" " + f); + else this.oc.writeInt(Float.floatToIntBits(f)); +}, "~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/_TachyonExporter.js b/config/plugins/visualizations/jmol/static/j2s/J/export/_TachyonExporter.js new file mode 100755 index 000000000000..f5cec55f0e55 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/_TachyonExporter.js @@ -0,0 +1,227 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["J.export.__RayTracerExporter", "$.UseTable"], "J.export._TachyonExporter", ["JU.SB", "JV.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.lighting = null; +this.phong = null; +this.textures = null; +this.textureCode = null; +Clazz.instantialize(this, arguments);}, J["export"], "_TachyonExporter", J["export"].__RayTracerExporter); +Clazz.prepareFields (c$, function(){ +this.textures = new J["export"].UseTable(" "); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J["export"]._TachyonExporter, []); +this.commentChar = "# "; +}); +Clazz.overrideMethod(c$, "initializeOutput", +function(vwr, privateKey, gdata, params){ +this.getLightingInfo(); +return this.initOutput(vwr, privateKey, gdata, params); +}, "JV.Viewer,~N,JU.GData,java.util.Map"); +Clazz.defineMethod(c$, "getLightingInfo", +function(){ +this.lighting = " AMBIENT " + J["export"].___Exporter.round(this.gdata.getAmbientPercent() / 100) + " DIFFUSE " + J["export"].___Exporter.round(this.gdata.getDiffusePercent() / 100) + " SPECULAR " + J["export"].___Exporter.round(this.gdata.getSpecularPercent() / 100); +this.phong = " Phong Plastic 0.5 Phong_size " + this.gdata.getSpecularExponent(); +}); +Clazz.overrideMethod(c$, "outputHeader", +function(){ +this.initVars(); +this.output("# ******************************************************\n"); +this.output("# Created by Jmol " + JV.Viewer.getJmolVersion() + "\n"); +this.output("#\n"); +this.output("# This script was generated on " + this.getExportDate() + "\n"); +this.output("#\n"); +this.output("# Requires Tachyon version 0.98.7 or newer\n"); +this.output("#\n"); +this.output("# Default tachyon rendering command for this scene:\n"); +this.output("# tachyon -aasamples 12 %s -format TARGA -o %s.tga\n"); +this.output("#\n"); +this.output("# ******************************************************\n"); +this.output("\n"); +this.output(this.getJmolPerspective()); +this.output("\n"); +this.output("Begin_Scene\n"); +this.output("Resolution " + this.screenWidth + " " + this.screenHeight + "\n"); +this.output("Shader_Mode Medium\n"); +this.output(" Trans_VMD\n"); +this.output(" Fog_VMD\n"); +this.output("End_Shader_Mode\n"); +this.output("Camera\n"); +this.output(" Zoom 3.0\n"); +this.output(" Aspectratio 1\n"); +this.output(" Antialiasing 12\n"); +this.output(" Raydepth 8\n"); +this.output(" Center " + this.triad(Clazz.doubleToInt(this.screenWidth / 2), Clazz.doubleToInt(this.screenHeight / 2), 0) + "\n"); +this.output(" Viewdir 0 0 1\n"); +this.output(" Updir 0 1 0\n"); +this.output("End_Camera\n"); +this.output("Directional_Light Direction " + J["export"].___Exporter.round(this.lightSource) + " Color 1 1 1\n"); +this.output("\n"); +this.output("Background " + this.rgbFractionalFromColix(this.backgroundColix) + "\n"); +this.output("\n"); +}); +Clazz.overrideMethod(c$, "outputFooter", +function(){ +this.output("End_Scene\n"); +}); +Clazz.defineMethod(c$, "output", +function(pt){ +this.output(this.triad(pt)); +}, "JU.T3"); +Clazz.defineMethod(c$, "triad", +function(x, y, z){ +return Clazz.floatToInt(x) + " " + Clazz.floatToInt(-y) + " " + Clazz.floatToInt(z); +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "triad", +function(pt){ +if (Float.isNaN(pt.x)) return "0 0 0"; +return this.triad(pt.x, pt.y, pt.z); +}, "JU.T3"); +Clazz.defineMethod(c$, "outputTextureCode", +function(){ +this.output(this.textureCode); +this.output("\n"); +}); +Clazz.defineMethod(c$, "outputTexture", +function(colix, useTexDef){ +this.outputTexture2(this.rgbFractionalFromColix(colix), J["export"].___Exporter.opacityFractionalFromColix(colix), useTexDef); +}, "~N,~B"); +Clazz.defineMethod(c$, "outputTexture", +function(argb, useTexDef){ +this.outputTexture2(this.rgbFractionalFromArgb(argb), J["export"].___Exporter.opacityFractionalFromArgb(argb), useTexDef); +}, "~N,~B"); +Clazz.defineMethod(c$, "outputTexture2", +function(rgb, opacity, useTexDef){ +this.textureCode = (useTexDef ? this.textures.getDef("t" + rgb + opacity) : null); +if (useTexDef && this.textureCode.startsWith(" ")) return; +var sb = new JU.SB(); +sb.append(this.lighting); +sb.append(" Opacity " + opacity); +sb.append(this.phong); +sb.append(" Color " + rgb); +sb.append(" TexFunc 0\n"); +if (!useTexDef) { +this.textureCode = "Texture " + sb; +return; +}this.output("TexDef " + this.textureCode); +this.output(sb.toString()); +this.textureCode = " " + this.textureCode; +}, "~S,~S,~B"); +Clazz.overrideMethod(c$, "outputCircle", +function(x, y, z, radius, colix, doFill){ +this.tempV1.set(0, 0, -1); +this.outputRing(x, y, z, this.tempV1, radius, colix, doFill); +}, "~N,~N,~N,~N,~N,~B"); +Clazz.defineMethod(c$, "outputRing", +function(x, y, z, tempV1, radius, colix, doFill){ +this.outputTexture(colix, true); +this.output("Ring Center "); +this.output(this.triad(x, y, z)); +this.output(" Normal " + this.triad(tempV1)); +this.output(" Inner " + J["export"].___Exporter.round((doFill ? 0 : radius * 0.95))); +this.output(" Outer " + J["export"].___Exporter.round(radius)); +this.outputTextureCode(); +}, "~N,~N,~N,JU.V3,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputCone", +function(screenBase, screenTip, radius, colix, isBarb){ +this.tm.unTransformPoint(screenBase, this.tempP1); +this.tm.unTransformPoint(screenTip, this.tempP2); +radius = this.vwr.tm.unscaleToScreen(screenBase.z, radius); +var matRotateScale = this.getRotationMatrix(this.tempP1, this.tempP2, radius); +this.export3D.drawSurface(J["export"].___Exporter.getConeMesh(this.tempP1, matRotateScale, colix), colix); +}, "JU.P3,JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputCylinder", +function(screenA, screenB, radius, colix, withCaps){ +this.outputTexture(colix, true); +this.output("FCylinder Base "); +this.output(this.triad(screenA)); +this.output(" Apex "); +this.output(this.triad(screenB)); +this.output(" Rad " + J["export"].___Exporter.round(radius)); +this.outputTextureCode(); +if (withCaps && radius > 1) { +this.tempV1.sub2(screenA, screenB); +this.outputRing(Clazz.floatToInt(screenA.x), Clazz.floatToInt(screenA.y), Clazz.floatToInt(screenA.z), this.tempV1, radius, colix, true); +this.tempV1.scale(-1); +this.outputRing(Clazz.floatToInt(screenB.x), Clazz.floatToInt(screenB.y), Clazz.floatToInt(screenB.z), this.tempV1, radius, colix, true); +}}, "JU.P3,JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "fillConicalCylinder", +function(screenA, screenB, madBond, colix, endcaps){ +var diameter = Clazz.floatToInt(this.vwr.tm.scaleToScreen(Clazz.floatToInt((screenA.z + screenB.z) / 2), madBond)); +this.fillCylinderScreenMad(colix, endcaps, diameter, screenA, screenB); +}, "JU.P3,JU.P3,~N,~N,~N"); +Clazz.overrideMethod(c$, "outputCylinderConical", +function(screenA, screenB, radius1, radius2, colix){ +}, "JU.P3,JU.P3,~N,~N,~N"); +Clazz.overrideMethod(c$, "outputEllipsoid", +function(center, radius, coef, colix){ +this.tm.transformPt3f(center, this.tempP1); +this.outputSphere(this.tempP1.x, this.tempP1.y, this.tempP1.z, radius, colix); +}, "JU.P3,~N,~A,~N"); +Clazz.overrideMethod(c$, "outputSurface", +function(vertices, normals, colixes, indices, polygonColixes, nVertices, nPolygons, nTriangles, bsPolygons, faceVertexMax, colix, colorList, htColixes, offset){ +if (polygonColixes != null) { +var isAll = (bsPolygons == null); +var i0 = (isAll ? nPolygons - 1 : bsPolygons.nextSetBit(0)); +for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsPolygons.nextSetBit(i + 1))) { +J["export"].___Exporter.setTempVertex(vertices[indices[i][0]], offset, this.tempP1); +J["export"].___Exporter.setTempVertex(vertices[indices[i][1]], offset, this.tempP2); +J["export"].___Exporter.setTempVertex(vertices[indices[i][2]], offset, this.tempP3); +this.tm.transformPt3f(this.tempP1, this.tempP1); +this.tm.transformPt3f(this.tempP2, this.tempP2); +this.tm.transformPt3f(this.tempP3, this.tempP3); +this.outputTriangle(this.tempP1, this.tempP2, this.tempP3, colix); +} +return; +}this.outputTexture(colixes == null ? colix : colixes[0], false); +this.output("VertexArray Numverts " + nVertices + "\nCoords\n"); +for (var i = 0; i < nVertices; i++) this.outputVertex(vertices[i], offset); + +this.output("\nNormals\n"); +for (var i = 0; i < nVertices; i++) { +J["export"].___Exporter.setTempVertex(vertices[i], offset, this.tempP1); +this.output(this.triad(this.getScreenNormal(this.tempP1, normals[i], 10)) + "\n"); +} +var rgb = (colixes == null ? this.rgbFractionalFromColix(colix) : null); +this.output("\nColors\n"); +for (var i = 0; i < nVertices; i++) { +this.output((colixes == null ? rgb : this.rgbFractionalFromColix(colixes[i])) + "\n"); +} +this.outputTextureCode(); +this.output("\nTriMesh " + nTriangles + "\n"); +var isAll = (bsPolygons == null); +var i0 = (isAll ? nPolygons - 1 : bsPolygons.nextSetBit(0)); +for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsPolygons.nextSetBit(i + 1))) { +this.output(indices[i][0] + " " + indices[i][1] + " " + indices[i][2] + "\n"); +if (faceVertexMax == 4 && indices[i].length == 4) this.output(indices[i][0] + " " + indices[i][2] + " " + indices[i][3] + "\n"); +} +this.output("\nEnd_VertexArray\n"); +}, "~A,~A,~A,~A,~A,~N,~N,~N,JU.BS,~N,~N,JU.Lst,java.util.Map,JU.P3"); +Clazz.overrideMethod(c$, "outputSphere", +function(x, y, z, radius, colix){ +this.outputTexture(colix, true); +this.output("Sphere Center "); +this.output(this.triad(x, y, z)); +this.output(" Rad " + J["export"].___Exporter.round(radius)); +this.outputTextureCode(); +}, "~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "outputTextPixel", +function(x, y, z, argb){ +this.outputTexture(argb, true); +this.output("Sphere Center "); +this.output(this.triad(x, y, z)); +this.output(" Rad 1"); +this.outputTextureCode(); +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "outputTriangle", +function(ptA, ptB, ptC, colix){ +this.outputTexture(colix, true); +this.output("TRI"); +this.output(" V0 " + this.triad(ptA)); +this.output(" V1 " + this.triad(ptB)); +this.output(" V2 " + this.triad(ptC)); +this.outputTextureCode(); +}, "JU.T3,JU.T3,JU.T3,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/_VrmlExporter.js b/config/plugins/visualizations/jmol/static/j2s/J/export/_VrmlExporter.js new file mode 100755 index 000000000000..a6d3997fbf86 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/_VrmlExporter.js @@ -0,0 +1,552 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["J.export.__CartesianExporter", "java.util.Hashtable", "JU.P3"], "J.export._VrmlExporter", ["JU.A4", "$.AU", "$.Lst", "$.Measure", "$.PT", "$.Quat", "J.export.UseTable", "JU.Geodesic", "JV.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.useTable = null; +this.htSpheresRendered = null; +this.plateVertices = null; +this.plateIndices = null; +this.plateColixes = null; +this.tempQ1 = null; +this.tempQ2 = null; +this.tempQ3 = null; +this.oneFace = null; +this.threeVertices = null; +this.fontSize = 0; +this.fontFace = null; +this.fontStyle = null; +this.fontChild = null; +Clazz.instantialize(this, arguments);}, J["export"], "_VrmlExporter", J["export"].__CartesianExporter); +Clazz.prepareFields (c$, function(){ +this.htSpheresRendered = new java.util.Hashtable(); +this.tempQ1 = new JU.P3(); +this.tempQ2 = new JU.P3(); +this.tempQ3 = new JU.P3(); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J["export"]._VrmlExporter, []); +this.useTable = new J["export"].UseTable("USE "); +this.commentChar = "# "; +this.canCapCylinders = true; +this.solidOnly = true; +}); +Clazz.defineMethod(c$, "output", +function(pt){ +this.output(J["export"].___Exporter.round(pt)); +}, "JU.T3"); +Clazz.overrideMethod(c$, "outputHeader", +function(){ +this.output("#VRML V2.0 utf8 Generated by Jmol " + JV.Viewer.getJmolVersion() + "\n"); +this.output("WorldInfo { \n"); +this.output(" title " + JU.PT.esc(this.vwr.ms.modelSetName) + "\n"); +this.output(" info [ \"Generated by Jmol " + JV.Viewer.getJmolVersion() + " \", \n"); +this.output(" \"http://www.jmol.org \", \n"); +this.output(" \"Creation date: " + this.getExportDate() + " \" ]\n"); +this.output("} \n"); +this.output("NavigationInfo { type \"EXAMINE\" } \n"); +this.output("Background { skyColor [" + this.rgbFractionalFromColix(this.backgroundColix) + "] } \n"); +var angle = this.getViewpoint(); +this.output("Viewpoint{fieldOfView " + angle); +this.output(" position "); +this.cameraPosition.scale(this.exportScale); +this.output(this.cameraPosition); +this.output(" orientation "); +this.output(this.tempP1); +this.output(" " + -this.viewpoint.angle); +this.output("\n jump TRUE description \"v1\"\n}\n\n"); +this.output(this.getJmolPerspective()); +this.outputInitialTransform(); +this.output("\n"); +}); +Clazz.defineMethod(c$, "outputInitialTransform", +function(){ +this.pushMatrix(); +this.outputAttr("scale", this.exportScale, this.exportScale, this.exportScale); +this.outputCloseTag(); +this.outputChildStart(); +this.pushMatrix(); +this.tempP1.setT(this.center); +this.tempP1.scale(-1); +this.outputAttrPt("translation", this.tempP1); +this.outputCloseTag(); +this.outputChildStart(); +}); +Clazz.defineMethod(c$, "getViewpoint", +function(){ +this.viewpoint.setM(this.vwr.tm.matrixRotate); +this.tempP1.set(this.viewpoint.x, this.viewpoint.y, (this.viewpoint.angle == 0 ? 1 : this.viewpoint.z)); +return (this.apertureAngle * 3.141592653589793 / 180); +}); +Clazz.overrideMethod(c$, "outputFooter", +function(){ +this.useTable = null; +this.output("\n]}\n"); +this.output("]}"); +}); +Clazz.defineMethod(c$, "outputAppearance", +function(colix, isText){ +var def = this.getDef((isText ? "T" : "") + colix); +this.output("appearance "); +if (def.charAt(0) == '_') { +var color = this.rgbFractionalFromColix(colix); +this.output(" DEF " + def + " Appearance{material Material{diffuseColor "); +if (isText) this.output(" 0 0 0 specularColor 0 0 0 ambientIntensity 0.0 shininess 0.0 emissiveColor " + color + " }}"); + else this.output(color + " transparency " + J["export"].___Exporter.translucencyFractionalFromColix(colix) + "}}"); +return; +}this.output(def); +}, "~N,~B"); +Clazz.defineMethod(c$, "pushMatrix", +function(){ +this.output("Transform{"); +}); +Clazz.defineMethod(c$, "popMatrix", +function(){ +this.output("}\n"); +}); +Clazz.defineMethod(c$, "outputAttrPt", +function(attr, pt){ +this.output(" " + attr + " " + pt.x + " " + pt.y + " " + pt.z); +}, "~S,JU.T3"); +Clazz.defineMethod(c$, "outputAttr", +function(attr, x, y, z){ +this.output(" " + attr + " " + J["export"].___Exporter.round(x) + " " + J["export"].___Exporter.round(y) + " " + J["export"].___Exporter.round(z)); +}, "~S,~N,~N,~N"); +Clazz.defineMethod(c$, "outputRotation", +function(a){ +this.output(" rotation " + a.x + " " + a.y + " " + a.z + " " + a.angle); +}, "JU.A4"); +Clazz.defineMethod(c$, "outputTransRot", +function(pt1, pt2, x, y, z){ +this.tempV1.ave(pt2, pt1); +this.outputAttrPt("translation", this.tempV1); +this.tempV1.sub(pt1); +this.tempV1.normalize(); +this.tempV2.set(x, y, z); +this.tempV2.add(this.tempV1); +this.outputRotation(JU.A4.newVA(this.tempV2, 3.141592653589793)); +}, "JU.P3,JU.P3,~N,~N,~N"); +Clazz.defineMethod(c$, "outputQuaternionFrame", +function(ptCenter, ptX, ptY, ptZ, xScale, yScale, zScale){ +this.tempQ1.setT(ptX); +this.tempQ2.setT(ptY); +var a = JU.Quat.getQuaternionFrame(ptCenter, this.tempQ1, this.tempQ2).toAxisAngle4f(); +if (!Float.isNaN(a.x)) { +this.tempQ1.set(a.x, a.y, a.z); +this.outputRotation(a); +}var sx = (ptX.distance(ptCenter) * xScale); +var sy = (ptY.distance(ptCenter) * yScale); +var sz = (ptZ.distance(ptCenter) * zScale); +this.outputAttr("scale", sx, sy, sz); +}, "JU.P3,JU.P3,JU.P3,JU.P3,~N,~N,~N"); +Clazz.defineMethod(c$, "outputChildShapeStart", +function(){ +this.outputChildStart(); +this.outputShapeStart(); +}); +Clazz.defineMethod(c$, "outputChildStart", +function(){ +this.output(" children["); +}); +Clazz.defineMethod(c$, "outputShapeStart", +function(){ +this.output(" Shape{geometry "); +}); +Clazz.defineMethod(c$, "outputDefChildFaceSet", +function(child){ +if (child != null) this.output("DEF " + child + " "); +this.outputFaceSetStart(); +}, "~S"); +Clazz.defineMethod(c$, "outputFaceSetStart", +function(){ +this.output("IndexedFaceSet {"); +}); +Clazz.defineMethod(c$, "outputFaceSetClose", +function(){ +this.output("}\n"); +}); +Clazz.defineMethod(c$, "outputUseChildClose", +function(child){ +this.output(child); +}, "~S"); +Clazz.defineMethod(c$, "outputChildShapeClose", +function(){ +this.outputShapeClose(); +this.outputChildClose(); +}); +Clazz.defineMethod(c$, "outputChildClose", +function(){ +this.output("]"); +}); +Clazz.defineMethod(c$, "outputShapeClose", +function(){ +this.output("}"); +}); +Clazz.defineMethod(c$, "outputCloseTag", +function(){ +}); +Clazz.overrideMethod(c$, "outputCircle", +function(pt1, pt2, radius, colix, doFill){ +if (doFill) { +this.pushMatrix(); +this.tempV1.ave(pt1, pt2); +this.outputAttr("translation", this.tempV1.x, this.tempV1.y, this.tempV1.z); +this.output(" children [ Billboard{axisOfRotation 0 0 0 children [ Transform{rotation 1 0 0 1.5708"); +var height = (pt1.distance(pt2)); +this.outputAttr("scale", radius, height, radius); +this.outputCylinderChildScaled(colix, 2); +this.output("}] }]\n"); +this.popMatrix(); +return; +}var child = this.getDef("C" + colix + "_" + radius); +this.pushMatrix(); +this.outputTransRot(pt1, pt2, 0, 0, 1); +this.outputAttr("scale", radius, radius, radius); +this.output(" children ["); +if (child.charAt(0) == '_') { +this.output("DEF " + child); +this.output(" Billboard{axisOfRotation 0 0 0 children [ Transform{children["); +this.output(" Shape{"); +this.output("geometry Extrusion{beginCap FALSE convex FALSE endCap FALSE creaseAngle 1.57"); +this.output(" crossSection ["); +var rpd = 0.017453292; +var scale = 0.02 / radius; +for (var i = 0; i <= 360; i += 10) { +this.output(J["export"].___Exporter.round(Math.cos(i * rpd) * scale) + " "); +this.output(J["export"].___Exporter.round(Math.sin(i * rpd) * scale) + " "); +} +this.output("] spine ["); +for (var i = 0; i <= 360; i += 10) { +this.output(J["export"].___Exporter.round(Math.cos(i * rpd)) + " "); +this.output(J["export"].___Exporter.round(Math.sin(i * rpd)) + " 0 "); +} +this.output("]"); +this.output("}"); +this.outputAppearance(colix, false); +this.output("}"); +this.output("]} ]}"); +} else { +this.output(child); +}this.output("]"); +this.popMatrix(); +}, "JU.P3,JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputCone", +function(ptBase, ptTip, radius, colix){ +var height = (ptBase.distance(ptTip)); +this.pushMatrix(); +this.outputTransRot(ptBase, ptTip, 0, 1, 0); +this.outputAttr("scale", radius, height, radius); +this.outputCloseTag(); +this.outputChildShapeStart(); +var child = this.getDef("c"); +if (child.charAt(0) == '_') { +this.outputDefChildFaceSet(child); +this.outputConeGeometry(true); +this.outputFaceSetClose(); +} else { +this.outputUseChildClose(child); +}this.outputAppearance(colix, false); +this.outputChildShapeClose(); +this.popMatrix(); +}, "JU.P3,JU.P3,~N,~N"); +Clazz.defineMethod(c$, "outputConeGeometry", +function(addBase){ +var ndeg = 10; +var n = Clazz.doubleToInt(360 / ndeg); +var vertexCount = n + (addBase ? 2 : 1); +var faces = JU.AU.newInt2(n * (addBase ? 2 : 1)); +for (var i = 0, fpt = 0; i < n; i++) { +faces[fpt++] = Clazz.newIntArray(-1, [i, (i + n - 1) % n, n]); +if (addBase) faces[fpt++] = Clazz.newIntArray(-1, [i, (i + 1) % n, n + 1]); +} +var vertexes = new Array(vertexCount); +for (var i = 0; i < n; i++) { +var x = (Math.cos(i * ndeg / 180. * 3.141592653589793)); +var y = (Math.sin(i * ndeg / 180. * 3.141592653589793)); +vertexes[i] = JU.P3.new3(x, -0.5, y); +} +vertexes[n++] = JU.P3.new3(0, 0.5, 0); +if (addBase) vertexes[n++] = JU.P3.new3(0, -0.5, 0); +this.outputGeometry(vertexes, null, null, faces, null, vertexCount, faces.length, null, 3, null, null, null); +}, "~B"); +Clazz.overrideMethod(c$, "outputCylinder", +function(ptCenter, pt1, pt2, colix, endcaps, radius, ptX, ptY, checkRadius){ +var height = (pt1.distance(pt2)); +if (radius < 0.01 || height == 0) return false; +this.pushMatrix(); +if (ptX == null) { +this.outputTransRot(pt1, pt2, 0, 1, 0); +this.outputAttr("scale", radius, height, radius); +} else { +this.outputAttrPt("translation", ptCenter); +this.outputQuaternionFrame(ptCenter, ptY, pt1, ptX, 2, 2, 2); +pt1.set(0, 0, -0.5); +pt2.set(0, 0, 0.5); +}this.outputCloseTag(); +this.outputCylinderChildScaled(colix, endcaps); +this.popMatrix(); +if (radius > 0.1) switch (endcaps) { +case 3: +this.outputSphere(pt1, radius * 1.01, colix, checkRadius); +case 5: +case 4: +this.outputSphere(pt2, radius * 1.01, colix, checkRadius); +break; +case 2: +break; +} +return true; +}, "JU.P3,JU.P3,JU.P3,~N,~N,~N,JU.P3,JU.P3,~B"); +Clazz.defineMethod(c$, "outputCylinderChildScaled", +function(colix, endcaps){ +this.outputChildShapeStart(); +var child = this.getDef("C" + "_" + endcaps); +if (child.charAt(0) == '_') { +this.outputDefChildFaceSet(child); +this.outputCylinderGeometry(endcaps); +this.outputFaceSetClose(); +} else { +this.outputUseChildClose(child); +}this.outputAppearance(colix, false); +this.outputChildShapeClose(); +}, "~N,~N"); +Clazz.defineMethod(c$, "outputCylinderGeometry", +function(endcaps){ +var ndeg = 10; +var n = Clazz.doubleToInt(360 / ndeg); +var vertexCount = n * 2; +var addEndcaps = false; +switch (endcaps) { +case 3: +case 5: +case 4: +case 2: +vertexCount += 2; +addEndcaps = true; +break; +} +var faces = JU.AU.newInt2(n * (addEndcaps ? 4 : 2)); +for (var i = 0, fpt = 0; i < n; i++) { +faces[fpt++] = Clazz.newIntArray(-1, [i, (i + 1) % n, i + n]); +faces[fpt++] = Clazz.newIntArray(-1, [(i + 1) % n, (i + 1) % n + n, i + n]); +if (addEndcaps) { +faces[fpt++] = Clazz.newIntArray(-1, [i, (i + n - 1) % n, vertexCount - 2]); +faces[fpt++] = Clazz.newIntArray(-1, [i + n, (i + n + 1) % n + n, vertexCount - 1]); +}} +var vertexes = new Array(vertexCount); +for (var i = 0; i < n; i++) { +var x = (Math.cos(i * ndeg / 180. * 3.141592653589793)); +var y = (Math.sin(i * ndeg / 180. * 3.141592653589793)); +vertexes[i] = JU.P3.new3(x, 0.5, y); +} +for (var i = 0; i < n; i++) { +var x = (Math.cos((i + 0.5) * ndeg / 180 * 3.141592653589793)); +var y = (Math.sin((i + 0.5) * ndeg / 180 * 3.141592653589793)); +vertexes[i + n] = JU.P3.new3(x, -0.5, y); +} +if (addEndcaps) { +vertexes[vertexCount - 2] = JU.P3.new3(0, 0.5, 0); +vertexes[vertexCount - 1] = JU.P3.new3(0, -0.5, 0); +}this.outputGeometry(vertexes, null, null, faces, null, vertexCount, faces.length, null, 3, null, null, null); +}, "~N"); +Clazz.overrideMethod(c$, "outputSphere", +function(ptCenter, radius, colix, checkRadius){ +var check = J["export"].___Exporter.round(ptCenter) + (checkRadius ? " " + Clazz.floatToInt(radius * 100) : ""); +if (this.htSpheresRendered.get(check) != null) return; +this.htSpheresRendered.put(check, Boolean.TRUE); +this.outputSphereChildScaled(ptCenter, radius, null, colix); +}, "JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputEllipsoid", +function(ptCenter, points, colix){ +this.outputSphereChildScaled(ptCenter, 1.0, points, colix); +}, "JU.P3,~A,~N"); +Clazz.defineMethod(c$, "outputSphereChildScaled", +function(ptCenter, radius, points, colix){ +this.pushMatrix(); +this.outputAttrPt("translation", ptCenter); +if (points == null) this.outputAttr("scale", radius, radius, radius); + else this.outputQuaternionFrame(ptCenter, points[1], points[3], points[5], 1, 1, 1); +this.outputCloseTag(); +this.outputChildShapeStart(); +var child = this.getDef("S"); +if (child.charAt(0) == '_') { +this.outputDefChildFaceSet(child); +this.outputSphereGeometry(); +this.outputFaceSetClose(); +} else { +this.outputUseChildClose(child); +}this.outputAppearance(colix, false); +this.outputChildShapeClose(); +this.popMatrix(); +}, "JU.P3,~N,~A,~N"); +Clazz.defineMethod(c$, "outputSphereGeometry", +function(){ +var vertices = JU.Geodesic.getVertexVectors(); +var nVertices = 162; +var faceList = JU.Geodesic.getFaceVertexes(2); +var nFaces = Clazz.doubleToInt(faceList.length / 3); +var indices = Clazz.newIntArray (nFaces, 3, 0); +for (var i = 0, p = 0; i < nFaces; i++) for (var j = 0; j < 3; j++) indices[i][j] = faceList[p++]; + + +this.outputGeometry(vertices, null, null, indices, null, nVertices, nFaces, null, 3, null, null, null); +}); +Clazz.overrideMethod(c$, "outputSolidPlate", +function(tempP1, tempP2, tempP3, colix){ +if (this.plateVertices == null) { +this.plateVertices = new Array(6); +for (var i = 0; i < 6; i++) this.plateVertices[i] = new JU.P3(); + +this.plateIndices = Clazz.newArray(-1, [ Clazz.newIntArray(-1, [0, 1, 2]), Clazz.newIntArray(-1, [5, 4, 3]), Clazz.newIntArray(-1, [0, 3, 1]), Clazz.newIntArray(-1, [1, 3, 4]), Clazz.newIntArray(-1, [1, 4, 2]), Clazz.newIntArray(-1, [2, 4, 5]), Clazz.newIntArray(-1, [2, 5, 0]), Clazz.newIntArray(-1, [0, 5, 3])]); +}JU.Measure.calcNormalizedNormal(tempP1, tempP2, tempP3, this.tempV1, this.tempV2); +this.tempV1.scale(0.2); +this.plateVertices[0].setT(tempP1); +this.plateVertices[1].setT(tempP2); +this.plateVertices[2].setT(tempP3); +for (var i = 0; i < 3; i++) this.plateVertices[i].add(this.tempV1); + +this.tempV1.scale(-2); +for (var i = 3; i < 6; i++) this.plateVertices[i].add2(this.plateVertices[i - 3], this.tempV1); + +this.outputSurface(this.plateVertices, null, null, this.plateIndices, this.plateColixes, 6, 8, 8, null, 3, colix, null, null, null); +}, "JU.P3,JU.P3,JU.P3,~N"); +Clazz.overrideMethod(c$, "outputSurface", +function(vertices, normals, colixes, indices, polygonColixes, nVertices, nPolygons, nTriangles, bsPolygons, faceVertexMax, colix, colorList, htColixes, offset){ +this.outputShapeStart(); +this.outputDefChildFaceSet(null); +this.outputGeometry(vertices, normals, colixes, indices, polygonColixes, nVertices, nPolygons, bsPolygons, faceVertexMax, colorList, htColixes, offset); +this.outputFaceSetClose(); +this.outputAppearance(colix, false); +this.outputShapeClose(); +}, "~A,~A,~A,~A,~A,~N,~N,~N,JU.BS,~N,~N,JU.Lst,java.util.Map,JU.P3"); +Clazz.defineMethod(c$, "outputGeometry", +function(vertices, normals, colixes, indices, polygonColixes, nVertices, nPolygons, bsPolygons, faceVertexMax, colorList, htColixes, offset){ +if (polygonColixes == null) this.output(" creaseAngle 0.5 \n"); + else this.output(" colorPerVertex FALSE\n"); +this.output("coord Coordinate {\npoint [\n"); +this.outputVertices(vertices, nVertices, offset); +this.output(" ]\n"); +this.output(" }\n"); +this.output(" coordIndex [\n"); +var map = Clazz.newIntArray (nVertices, 0); +this.getCoordinateMap(vertices, map, null); +this.outputIndices(indices, map, nPolygons, bsPolygons, faceVertexMax); +this.output(" ]\n"); +if (normals != null) { +var vNormals = new JU.Lst(); +map = this.getNormalMap(normals, nVertices, null, vNormals); +this.output(" solid FALSE\n normalPerVertex TRUE\n normal Normal {\n vector [\n"); +this.outputNormals(vNormals); +this.output(" ]\n"); +this.output(" }\n"); +this.output(" normalIndex [\n"); +this.outputIndices(indices, map, nPolygons, bsPolygons, faceVertexMax); +this.output(" ]\n"); +}map = null; +if (colorList != null) { +this.output(" color Color { color [\n"); +this.outputColors(colorList); +this.output(" ] } \n"); +this.output(" colorIndex [\n"); +this.outputColorIndices(indices, nPolygons, bsPolygons, faceVertexMax, htColixes, colixes, polygonColixes); +this.output(" ]\n"); +}}, "~A,~A,~A,~A,~A,~N,~N,JU.BS,~N,JU.Lst,java.util.Map,JU.P3"); +Clazz.overrideMethod(c$, "outputFace", +function(face, map, faceVertexMax){ +this.output(map[face[0]] + " " + map[face[1]] + " " + map[face[2]] + " -1\n"); +if (faceVertexMax == 4 && face.length == 4) this.output(map[face[0]] + " " + map[face[2]] + " " + map[face[3]] + " -1\n"); +}, "~A,~A,~N"); +Clazz.defineMethod(c$, "outputNormals", +function(vNormals){ +var n = vNormals.size(); +for (var i = 0; i < n; i++) { +this.output(vNormals.get(i)); +} +}, "JU.Lst"); +Clazz.defineMethod(c$, "outputColors", +function(colorList){ +var nColors = colorList.size(); +for (var i = 0; i < nColors; i++) { +var color = this.rgbFractionalFromColix(colorList.get(i).shortValue()); +this.output(" "); +this.output(color); +this.output("\n"); +} +}, "JU.Lst"); +Clazz.defineMethod(c$, "outputColorIndices", +function(indices, nPolygons, bsPolygons, faceVertexMax, htColixes, colixes, polygonColixes){ +var isAll = (bsPolygons == null); +var i0 = (isAll ? nPolygons - 1 : bsPolygons.nextSetBit(0)); +for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsPolygons.nextSetBit(i + 1))) { +if (polygonColixes == null) { +this.output(htColixes.get(Short.$valueOf(colixes[indices[i][0]])) + " " + htColixes.get(Short.$valueOf(colixes[indices[i][1]])) + " " + htColixes.get(Short.$valueOf(colixes[indices[i][2]])) + " -1\n"); +if (faceVertexMax == 4 && indices[i].length == 4) this.output(htColixes.get(Short.$valueOf(colixes[indices[i][0]])) + " " + htColixes.get(Short.$valueOf(colixes[indices[i][2]])) + " " + htColixes.get(Short.$valueOf(colixes[indices[i][3]])) + " -1\n"); +} else { +this.output(htColixes.get(Short.$valueOf(polygonColixes[i])) + "\n"); +}} +}, "~A,~N,JU.BS,~N,java.util.Map,~A,~A"); +Clazz.overrideMethod(c$, "outputTriangle", +function(pt1, pt2, pt3, colix){ +this.output("Shape{geometry IndexedFaceSet{ "); +this.outputTriangleGeometry(pt1, pt2, pt3, colix); +this.output("}\n"); +this.outputAppearance(colix, false); +this.output("}\n"); +}, "JU.T3,JU.T3,JU.T3,~N"); +Clazz.defineMethod(c$, "outputTriangleGeometry", +function(pt1, pt2, pt3, colix){ +if (this.oneFace == null) { +this.oneFace = Clazz.newArray(-1, [ Clazz.newIntArray(-1, [0, 1, 2])]); +this.threeVertices = Clazz.newArray(-1, [this.tempP1, this.tempP2, this.tempP3]); +}this.threeVertices[0].setT(pt1); +this.threeVertices[1].setT(pt2); +this.threeVertices[2].setT(pt3); +this.outputGeometry(this.threeVertices, null, null, this.oneFace, null, 3, 1, null, 3, null, null, null); +}, "JU.T3,JU.T3,JU.T3,~N"); +Clazz.overrideMethod(c$, "outputTextPixel", +function(pt, argb){ +}, "JU.P3,~N"); +Clazz.overrideMethod(c$, "plotText", +function(x, y, z, colix, text, font3d){ +this.pushMatrix(); +this.tempP3.set(x, y, this.fixScreenZ(z)); +this.tm.unTransformPoint(this.tempP3, this.tempP1); +this.outputAttrPt("translation", this.tempP1); +this.setFont(colix, text, font3d); +this.outputChildStart(); +if (this.fontChild.charAt(0) == '_') { +this.output("DEF " + this.fontChild + " Billboard{"); +this.outputAttr("axisOfRotation", 0, 0, 0); +this.outputChildStart(); +this.pushMatrix(); +this.outputChildShapeStart(); +this.output("Text{fontStyle "); +var fontstyle = this.getDef("F" + this.fontFace + this.fontStyle); +if (fontstyle.charAt(0) == '_') { +this.output("DEF " + fontstyle + " FontStyle{size " + this.fontSize + " family \"" + this.fontFace + "\" style \"" + this.fontStyle + "\"}"); +} else { +this.output(fontstyle); +}this.output(" string " + JU.PT.esc(text) + "}"); +this.outputAppearance(colix, true); +this.outputChildShapeClose(); +this.popMatrix(); +this.outputChildClose(); +this.output("}"); +} else { +this.output(this.fontChild); +}this.outputChildClose(); +this.popMatrix(); +}, "~N,~N,~N,~N,~S,JU.Font"); +Clazz.defineMethod(c$, "setFont", +function(colix, text, font3d){ +this.fontStyle = font3d.fontStyle.toUpperCase(); +this.fontFace = font3d.fontFace.toUpperCase(); +this.fontFace = (this.fontFace.equals("MONOSPACED") ? "TYPEWRITER" : this.fontFace.equals("SERIF") ? "SERIF" : "Arial"); +this.fontSize = font3d.fontSize * 0.015; +this.fontChild = this.getDef("T" + colix + this.fontFace + this.fontStyle + this.fontSize + "_" + text); +}, "~N,~S,JU.Font"); +Clazz.defineMethod(c$, "getDef", +function(key){ +return (this.useTable == null ? "_" : this.useTable.getDef(key)); +}, "~S"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/_X3dExporter.js b/config/plugins/visualizations/jmol/static/j2s/J/export/_X3dExporter.js new file mode 100755 index 000000000000..9c0dadd9a2c3 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/_X3dExporter.js @@ -0,0 +1,231 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["J.export._VrmlExporter"], "J.export._X3dExporter", ["JU.Lst", "$.PT", "J.export.UseTable", "JV.Viewer"], function(){ +var c$ = Clazz.declareType(J["export"], "_X3dExporter", J["export"]._VrmlExporter); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor(this, J["export"]._X3dExporter); +this.useTable = new J["export"].UseTable("USE='"); +}); +Clazz.overrideMethod(c$, "outputHeader", +function(){ +this.output("\n"); +this.output("\n"); +this.output(" \n"); +this.output("\n"); +this.output("\n"); +this.output("\n"); +this.output("\n"); +this.output("\n"); +this.output("\n"); +this.output("\n"); +this.output("\n"); +this.output(" \n"); +}); +Clazz.overrideMethod(c$, "outputAppearance", +function(colix, isText){ +var def = this.getDef((isText ? "T" : "") + colix); +this.output("\n"); +this.output(" \n"); +this.output("\n"); +this.output(" \n"); +var angle = this.getViewpoint(); +this.output(" \n"); +this.output("\n \n\n"); +this.commentChar = null; +this.outputInitialTransform(); +}); +Clazz.overrideMethod(c$, "outputAttrPt", +function(attr, pt){ +this.output(" " + attr + "='" + pt.x + " " + pt.y + " " + pt.z + "'"); +}, "~S,JU.T3"); +Clazz.overrideMethod(c$, "pushMatrix", +function(){ +this.output(" \n"); +}); +Clazz.overrideMethod(c$, "outputAttr", +function(attr, x, y, z){ +this.output(" " + attr + "='" + J["export"].___Exporter.round(x) + " " + J["export"].___Exporter.round(y) + " " + J["export"].___Exporter.round(z) + "'"); +}, "~S,~N,~N,~N"); +Clazz.overrideMethod(c$, "outputRotation", +function(a){ +this.output(" rotation='" + a.x + " " + a.y + " " + a.z + " " + a.angle + "'"); +}, "JU.A4"); +Clazz.overrideMethod(c$, "outputFooter", +function(){ +this.useTable = null; +this.popMatrix(); +this.popMatrix(); +this.output(" "); +}, "~N,~B"); +Clazz.overrideMethod(c$, "outputChildShapeStart", +function(){ +this.outputShapeStart(); +}); +Clazz.overrideMethod(c$, "outputShapeStart", +function(){ +this.output(" "); + else this.output(color + "' transparency='" + J["export"].___Exporter.translucencyFractionalFromColix(colix) + "'/>"); +} else this.output(def + ">"); +this.output(" "); +this.outputFaceSetStart(); +}); +Clazz.overrideMethod(c$, "outputChildStart", +function(){ +}); +Clazz.overrideMethod(c$, "outputChildClose", +function(){ +}); +Clazz.overrideMethod(c$, "outputDefChildFaceSet", +function(child){ +if (child != null) this.output("DEF='" + child + "'"); +}, "~S"); +Clazz.overrideMethod(c$, "outputFaceSetStart", +function(){ +this.output(" \n"); +}); +Clazz.overrideMethod(c$, "outputCloseTag", +function(){ +this.output(">\n"); +}); +Clazz.overrideMethod(c$, "outputTriangle", +function(pt1, pt2, pt3, colix){ +this.output("\n"); +}); +Clazz.overrideMethod(c$, "outputUseChildClose", +function(child){ +this.output(child + "/>"); +}, "~S"); +Clazz.overrideMethod(c$, "outputChildShapeClose", +function(){ +this.outputShapeClose(); +}); +Clazz.overrideMethod(c$, "outputShapeClose", +function(){ +this.output(" \n"); +this.output(" \n"); +}, "JU.T3,JU.T3,JU.T3,~N"); +Clazz.overrideMethod(c$, "outputCircle", +function(pt1, pt2, radius, colix, doFill){ +if (doFill) { +this.pushMatrix(); +this.output("translation='"); +this.tempV1.ave(this.tempP3, pt1); +this.output(this.tempV1); +this.output("'>"); +this.output(" \n"); +this.outputAppearance(colix, false); +this.output("\n"); +this.output(" "); +this.pushMatrix(); +this.output("rotation='1 0 0 1.5708'"); +var height = pt1.distance(pt2); +this.outputAttr("scale", radius, height, radius); +this.output(">"); +this.outputCylinderChildScaled(colix, 2); +this.popMatrix(); +this.output(" "); +this.popMatrix(); +return; +}var child = this.getDef("C" + colix + "_" + radius); +this.pushMatrix(); +this.outputTransRot(this.tempP3, pt1, 0, 0, 1); +this.tempP3.set(1, 1, 1); +this.tempP3.scale(radius); +this.outputAttr("scale", this.tempP3.x, this.tempP3.y, this.tempP3.z); +this.output(">\n"); +this.pushMatrix(); +this.output(" \n"); +this.popMatrix(); +}, "JU.P3,JU.P3,~N,~N,~B"); +Clazz.overrideMethod(c$, "outputGeometry", +function(vertices, normals, colixes, indices, polygonColixes, nVertices, nPolygons, bsPolygons, faceVertexMax, colorList, htColixes, offset){ +this.output(" creaseAngle='0.5'\n"); +if (polygonColixes != null) this.output(" colorPerVertex='false'\n"); +this.output("coordIndex='\n"); +var map = Clazz.newIntArray (nVertices, 0); +this.getCoordinateMap(vertices, map, null); +this.outputIndices(indices, map, nPolygons, bsPolygons, faceVertexMax); +this.output("'\n"); +var vNormals = null; +if (normals != null) { +vNormals = new JU.Lst(); +map = this.getNormalMap(normals, nVertices, null, vNormals); +this.output(" solid='false'\n normalPerVertex='true'\n normalIndex='\n"); +this.outputIndices(indices, map, nPolygons, bsPolygons, faceVertexMax); +this.output("'\n"); +}map = null; +if (colorList != null) { +this.output(" colorIndex='\n"); +this.outputColorIndices(indices, nPolygons, bsPolygons, faceVertexMax, htColixes, colixes, polygonColixes); +this.output("'\n"); +}this.output(">\n"); +this.output(""); +this.popMatrix(); +} else { +this.output(child + ">"); +}this.output(" "); +this.outputAppearance(colix, false); +this.output(" \n"); +if (normals != null) { +this.output(" \n"); +}if (colorList != null) { +this.output(" \n"); +}}, "~A,~A,~A,~A,~A,~N,~N,JU.BS,~N,JU.Lst,java.util.Map,JU.P3"); +Clazz.overrideMethod(c$, "outputTextPixel", +function(pt, argb){ +}, "JU.P3,~N"); +Clazz.overrideMethod(c$, "plotText", +function(x, y, z, colix, text, font3d){ +}, "~N,~N,~N,~N,~S,JU.Font"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/__CartesianExporter.js b/config/plugins/visualizations/jmol/static/j2s/J/export/__CartesianExporter.js new file mode 100755 index 000000000000..340390e6ffb4 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/__CartesianExporter.js @@ -0,0 +1,210 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["J.export.___Exporter", "JU.A4", "$.M4"], "J.export.__CartesianExporter", ["java.util.Hashtable", "JU.M3", "$.P3", "JU.C", "$.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.viewpoint = null; +this.canCapCylinders = false; +this.noColor = false; +this.sphereMatrix = null; +Clazz.instantialize(this, arguments);}, J["export"], "__CartesianExporter", J["export"].___Exporter); +Clazz.prepareFields (c$, function(){ +this.viewpoint = new JU.A4(); +this.sphereMatrix = new JU.M4(); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J["export"].__CartesianExporter, []); +this.exportType = 1; +this.lineWidthMad = 100; +}); +Clazz.defineMethod(c$, "getModelCenter", +function(){ +return this.referenceCenter; +}); +Clazz.defineMethod(c$, "getCameraPosition", +function(){ +var ptCamera = new JU.P3(); +var pt = JU.P3.new3(Clazz.doubleToInt(this.screenWidth / 2), Clazz.doubleToInt(this.screenHeight / 2), 0); +this.tm.unTransformPoint(pt, ptCamera); +ptCamera.sub(this.center); +this.tempP3.set(Clazz.doubleToInt(this.screenWidth / 2), Clazz.doubleToInt(this.screenHeight / 2), this.cameraDistance * this.scalePixelsPerAngstrom); +this.tm.unTransformPoint(this.tempP3, this.tempP3); +this.tempP3.sub(this.center); +ptCamera.add(this.tempP3); +return this.cameraPosition; +}); +Clazz.defineMethod(c$, "setTempPoints", +function(ptA, ptB, isCartesian){ +if (isCartesian) { +this.tempP1.setT(ptA); +this.tempP2.setT(ptB); +} else { +this.tm.unTransformPoint(ptA, this.tempP1); +this.tm.unTransformPoint(ptB, this.tempP2); +}}, "JU.P3,JU.P3,~B"); +Clazz.defineMethod(c$, "getCoordinateMap", +function(vertices, coordMap, bsValid){ +var n = 0; +for (var i = 0; i < coordMap.length; i++) { +if (bsValid != null && !bsValid.get(i) || Float.isNaN(vertices[i].x)) { +if (bsValid != null) bsValid.clear(i); +continue; +}coordMap[i] = n++; +} +return n; +}, "~A,~A,JU.BS"); +Clazz.defineMethod(c$, "getNormalMap", +function(normals, nNormals, bsValid, vNormals){ +var htNormals = new java.util.Hashtable(); +var normalMap = Clazz.newIntArray (nNormals, 0); +for (var i = 0; i < nNormals; i++) { +var s; +if (bsValid != null && !bsValid.get(i) || Float.isNaN(normals[i].x)) { +if (bsValid != null) bsValid.clear(i); +continue; +}s = this.getTriad(normals[i]) + "\n"; +if (htNormals.containsKey(s)) { +normalMap[i] = htNormals.get(s).intValue(); +} else { +normalMap[i] = vNormals.size(); +vNormals.addLast(s); +htNormals.put(s, Integer.$valueOf(normalMap[i])); +}} +return normalMap; +}, "~A,~N,JU.BS,JU.Lst"); +Clazz.defineMethod(c$, "outputIndices", +function(indices, map, nPolygons, bsPolygons, faceVertexMax){ +var isAll = (bsPolygons == null); +var i0 = (isAll ? nPolygons - 1 : bsPolygons.nextSetBit(0)); +for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsPolygons.nextSetBit(i + 1))) this.outputFace(indices[i], map, faceVertexMax); + +}, "~A,~A,~N,JU.BS,~N"); +Clazz.overrideMethod(c$, "plotText", +function(x, y, z, colix, text, font3d){ +this.gdata.plotText(x, y, z, this.gdata.getColorArgbOrGray(colix), 0, text, font3d, this.export3D); +}, "~N,~N,~N,~N,~S,JU.Font"); +Clazz.overrideMethod(c$, "plotImage", +function(x, y, z, image, bgcolix, width, height){ +}, "~N,~N,~N,~O,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawAtom", +function(atom, radius){ +if (JU.Logger.debugging) this.outputComment("atom " + atom); +var colix = atom.colixAtom; +this.outputSphere(atom, radius == 0 ? atom.madAtom / 2000 : radius, colix, JU.C.isColixTranslucent(colix)); +}, "JM.Atom,~N"); +Clazz.overrideMethod(c$, "drawCircle", +function(x, y, z, diameter, colix, doFill){ +this.tempP3.set(x, y, z); +this.tm.unTransformPoint(this.tempP3, this.tempP1); +var radius = this.vwr.tm.unscaleToScreen(z, diameter) / 2; +this.tempP3.set(x, y, z + 1); +this.tm.unTransformPoint(this.tempP3, this.tempP3); +this.outputCircle(this.tempP1, this.tempP3, radius, colix, doFill); +}, "~N,~N,~N,~N,~N,~B"); +Clazz.overrideMethod(c$, "drawEllipse", +function(ptCenter, ptX, ptY, colix, doFill){ +this.tempV1.sub2(ptX, ptCenter); +this.tempV2.sub2(ptY, ptCenter); +this.tempV2.cross(this.tempV1, this.tempV2); +this.tempV2.normalize(); +this.tempV2.scale(doFill ? 0.002 : 0.005); +this.tempP1.sub2(ptCenter, this.tempV2); +this.tempP2.add2(ptCenter, this.tempV2); +return this.outputCylinder(ptCenter, this.tempP1, this.tempP2, colix, doFill ? 2 : 0, 1.01, ptX, ptY, true); +}, "JU.P3,JU.P3,JU.P3,~N,~B"); +Clazz.overrideMethod(c$, "drawPixel", +function(colix, x, y, z, scale){ +this.tempP3.set(x, y, z); +this.tm.unTransformPoint(this.tempP3, this.tempP1); +this.outputSphere(this.tempP1, 0.02 * scale, colix, true); +}, "~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawTextPixel", +function(argb, x, y, z){ +this.tempP3.set(x, y, z); +this.tm.unTransformPoint(this.tempP3, this.tempP1); +this.outputTextPixel(this.tempP1, argb); +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "fillConeScreen", +function(colix, endcap, screenDiameter, screenBase, screenTip, isBarb){ +this.tm.unTransformPoint(screenBase, this.tempP1); +this.tm.unTransformPoint(screenTip, this.tempP2); +var radius = this.vwr.tm.unscaleToScreen(screenBase.z, screenDiameter) / 2; +if (radius < 0.05) radius = 0.05; +this.outputCone(this.tempP1, this.tempP2, radius, colix); +}, "~N,~N,~N,JU.P3,JU.P3,~B"); +Clazz.overrideMethod(c$, "drawCylinder", +function(ptA, ptB, colix1, colix2, endcaps, mad, bondOrder){ +this.setTempPoints(ptA, ptB, bondOrder < 0); +var radius = mad / 2000; +if (JU.Logger.debugging) this.outputComment("bond " + ptA + " " + ptB); +if (colix1 == colix2 || this.noColor) { +this.outputCylinder(null, this.tempP1, this.tempP2, colix1, endcaps, radius, null, null, bondOrder != -1); +} else { +this.tempV2.ave(this.tempP2, this.tempP1); +this.tempP3.setT(this.tempV2); +if (this.solidOnly && endcaps == 0) endcaps = 2; + else if (this.canCapCylinders && endcaps == 3) endcaps = (this.solidOnly ? 5 : 4); +this.outputCylinder(null, this.tempP3, this.tempP1, colix1, (endcaps == 3 ? 0 : endcaps), radius, null, null, true); +this.outputCylinder(null, this.tempP3, this.tempP2, colix2, (endcaps == 3 ? 0 : endcaps), radius, null, null, true); +if (endcaps == 3) { +this.outputSphere(this.tempP1, radius * 1.01, colix1, bondOrder != -2); +this.outputSphere(this.tempP2, radius * 1.01, colix2, bondOrder != -2); +}}}, "JU.P3,JU.P3,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "fillCylinderScreenMad", +function(colix, endcaps, mad, screenA, screenB){ +var radius = mad / 2000; +this.setTempPoints(screenA, screenB, false); +this.outputCylinder(null, this.tempP1, this.tempP2, colix, endcaps, radius, null, null, true); +}, "~N,~N,~N,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "fillCylinderScreen", +function(colix, endcaps, screenDiameter, screenA, screenB, ptA, ptB, radius){ +if (ptA != null) { +this.drawCylinder(ptA, ptB, colix, colix, endcaps, Math.round(radius * 2000), -1); +return; +}var mad = (screenDiameter < 0 ? -screenDiameter * 10 : Math.round(this.vwr.tm.unscaleToScreen((screenA.z + screenB.z) / 2, screenDiameter)) * 1000); +this.fillCylinderScreenMad(colix, endcaps, mad, screenA, screenB); +}, "~N,~N,~N,JU.P3,JU.P3,JU.P3,JU.P3,~N"); +Clazz.overrideMethod(c$, "fillEllipsoid", +function(center, points, colix, x, y, z, diameter, toEllipsoidal, coef, deriv, octantPoints){ +this.outputEllipsoid(center, points, colix); +}, "JU.P3,~A,~N,~N,~N,~N,~N,JU.M3,~A,JU.M4,~A"); +Clazz.overrideMethod(c$, "fillSphere", +function(colix, diameter, pt){ +this.tm.unTransformPoint(pt, this.tempP1); +this.outputSphere(this.tempP1, this.vwr.tm.unscaleToScreen(pt.z, diameter) / 2, colix, true); +}, "~N,~N,JU.P3"); +Clazz.overrideMethod(c$, "fillTriangle", +function(colix, ptA, ptB, ptC, twoSided){ +this.tm.unTransformPoint(ptA, this.tempP1); +this.tm.unTransformPoint(ptB, this.tempP2); +this.tm.unTransformPoint(ptC, this.tempP3); +if (this.solidOnly) { +this.outputSolidPlate(this.tempP1, this.tempP2, this.tempP3, colix); +} else { +this.outputTriangle(this.tempP1, this.tempP2, this.tempP3, colix); +if (twoSided) this.outputTriangle(this.tempP1, this.tempP3, this.tempP2, colix); +}}, "~N,JU.T3,JU.T3,JU.T3,~B"); +Clazz.defineMethod(c$, "outputSolidPlate", +function(tempP1, tempP2, tempP3, colix){ +}, "JU.P3,JU.P3,JU.P3,~N"); +Clazz.defineMethod(c$, "setSphereMatrix", +function(center, rx, ry, rz, a, sphereMatrix){ +if (a != null) { +var m = new JU.M3(); +m.m00 = rx; +m.m11 = ry; +m.m22 = rz; +var mq = new JU.M3().setAA(a); +mq.mul(m); +sphereMatrix.setToM3(mq); +} else { +sphereMatrix.setIdentity(); +sphereMatrix.m00 = rx; +sphereMatrix.m11 = ry; +sphereMatrix.m22 = rz; +}sphereMatrix.m03 = center.x; +sphereMatrix.m13 = center.y; +sphereMatrix.m23 = center.z; +sphereMatrix.m33 = 1; +}, "JU.T3,~N,~N,~N,JU.A4,JU.M4"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/__RayTracerExporter.js b/config/plugins/visualizations/jmol/static/j2s/J/export/__RayTracerExporter.js new file mode 100755 index 000000000000..08ea30d832bd --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/__RayTracerExporter.js @@ -0,0 +1,139 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["J.export.___Exporter"], "J.export.__RayTracerExporter", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.isSlabEnabled = false; +this.minScreenDimension = 0; +this.wasPerspective = false; +Clazz.instantialize(this, arguments);}, J["export"], "__RayTracerExporter", J["export"].___Exporter); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J["export"].__RayTracerExporter, []); +this.exportType = 2; +this.lineWidthMad = 2; +}); +Clazz.defineMethod(c$, "initOutput", +function(vwr, privateKey, g3d, params){ +this.wasPerspective = vwr.tm.perspectiveDepth; +if (Clazz.superCall(this, J["export"].__RayTracerExporter, "initOutput", [vwr, privateKey, g3d, params])) { +vwr.tm.perspectiveDepth = false; +if (this.wasPerspective) vwr.shm.finalizeAtoms(null, false); +return true; +}return false; +}, "JV.Viewer,~N,JU.GData,java.util.Map"); +Clazz.defineMethod(c$, "finalizeOutput2", +function(){ +this.vwr.tm.perspectiveDepth = this.wasPerspective; +return Clazz.superCall(this, J["export"].__RayTracerExporter, "finalizeOutput2", []); +}); +Clazz.overrideMethod(c$, "outputVertex", +function(pt, offset){ +J["export"].___Exporter.setTempVertex(pt, offset, this.tempP1); +this.tm.transformPt3f(this.tempP1, this.tempP1); +this.output(this.tempP1); +}, "JU.T3,JU.T3"); +Clazz.defineMethod(c$, "getScreenNormal", +function(pt, normal, factor){ +if (Float.isNaN(normal.x)) { +this.tempP3.set(0, 0, 0); +return this.tempP3; +}this.tempP1.add2(pt, normal); +this.tm.transformPt3f(pt, this.tempP2); +this.tm.transformPt3f(this.tempP1, this.tempP3); +this.tempP3.sub(this.tempP2); +this.tempP3.scale(factor); +return this.tempP3; +}, "JU.T3,JU.T3,~N"); +Clazz.defineMethod(c$, "initVars", +function(){ +this.isSlabEnabled = this.tm.slabEnabled; +this.minScreenDimension = Math.min(this.screenWidth, this.screenHeight); +}); +Clazz.overrideMethod(c$, "drawAtom", +function(atom, radius){ +this.outputSphere(atom.sX, atom.sY, atom.sZ, atom.sD / 2, atom.colixAtom); +}, "JM.Atom,~N"); +Clazz.overrideMethod(c$, "drawCircle", +function(x, y, z, diameter, colix, doFill){ +var radius = diameter / 2; +this.outputCircle(x, y, z, radius, colix, doFill); +}, "~N,~N,~N,~N,~N,~B"); +Clazz.overrideMethod(c$, "drawEllipse", +function(ptAtom, ptX, ptY, colix, doFill){ +return false; +}, "JU.P3,JU.P3,JU.P3,~N,~B"); +Clazz.overrideMethod(c$, "drawPixel", +function(colix, x, y, z, scale){ +this.outputSphere(x, y, z, 0.75 * scale, colix); +}, "~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawTextPixel", +function(argb, x, y, z){ +this.outputTextPixel(x, y, this.fixScreenZ(z), argb); +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "fillConeScreen", +function(colix, endcap, screenDiameter, screenBase, screenTip, isBarb){ +this.outputCone(screenBase, screenTip, screenDiameter / 2, colix, isBarb); +}, "~N,~N,~N,JU.P3,JU.P3,~B"); +Clazz.overrideMethod(c$, "drawCylinder", +function(screenA, screenB, colix1, colix2, endcaps, madBond, bondOrder){ +if (colix1 == colix2) { +this.fillConicalCylinder(screenA, screenB, madBond, colix1, endcaps); +} else { +this.tempV2.ave(screenB, screenA); +this.tempP1.setT(this.tempV2); +this.fillConicalCylinder(screenA, this.tempP1, madBond, colix1, endcaps); +this.fillConicalCylinder(this.tempP1, screenB, madBond, colix2, endcaps); +}if (endcaps != 3) return; +var radius = this.vwr.tm.scaleToScreen(Clazz.floatToInt(screenA.z), madBond) / 2; +if (radius <= 1) return; +this.outputSphere(screenA.x, screenA.y, screenA.z, radius, colix1); +radius = this.vwr.tm.scaleToScreen(Clazz.floatToInt(screenB.z), madBond) / 2; +if (radius <= 1) return; +this.outputSphere(screenB.x, screenB.y, screenB.z, radius, colix2); +}, "JU.P3,JU.P3,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "fillConicalCylinder", +function(screenA, screenB, madBond, colix, endcaps){ +var radius1 = this.vwr.tm.scaleToScreen(Clazz.floatToInt(screenA.z), madBond) / 2; +if (radius1 == 0) return; +if (radius1 < 1) radius1 = 1; +if (screenA.distance(screenB) == 0) { +this.outputSphere(screenA.x, screenA.y, screenA.z, radius1, colix); +return; +}var radius2 = this.vwr.tm.scaleToScreen(Clazz.floatToInt(screenB.z), madBond) / 2; +if (radius2 == 0) return; +if (radius2 < 1) radius2 = 1; +this.outputCylinderConical(screenA, screenB, radius1, radius2, colix); +}, "JU.P3,JU.P3,~N,~N,~N"); +Clazz.overrideMethod(c$, "fillCylinderScreenMad", +function(colix, endcaps, diameter, screenA, screenB){ +if (diameter == 0) return; +if (diameter < 1) diameter = 1; +var radius = diameter / 2; +if (screenA.distance(screenB) == 0) { +this.outputSphere(screenA.x, screenA.y, screenA.z, radius, colix); +return; +}this.outputCylinder(screenA, screenB, radius, colix, endcaps == 2); +if (endcaps != 3 || radius <= 1) return; +this.outputSphere(screenA.x, screenA.y, screenA.z, radius, colix); +this.outputSphere(screenB.x, screenB.y, screenB.z, radius, colix); +}, "~N,~N,~N,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "fillCylinderScreen", +function(colix, endcaps, screenDiameter, screenA, screenB, ptA, ptB, radius){ +this.fillCylinderScreenMad(colix, endcaps, screenDiameter, screenA, screenB); +}, "~N,~N,~N,JU.P3,JU.P3,JU.P3,JU.P3,~N"); +Clazz.overrideMethod(c$, "fillSphere", +function(colix, diameter, pt){ +this.outputSphere(pt.x, pt.y, pt.z, diameter / 2, colix); +}, "~N,~N,JU.P3"); +Clazz.overrideMethod(c$, "fillTriangle", +function(colix, ptA, ptB, ptC, twoSided){ +this.outputTriangle(ptA, ptB, ptC, colix); +}, "~N,JU.T3,JU.T3,JU.T3,~B"); +Clazz.overrideMethod(c$, "fillEllipsoid", +function(center, points, colix, x, y, z, diameter, toEllipsoidal, coef, deriv, octantPoints){ +var radius = diameter / 2; +if (radius == 0) return; +if (radius < 1) radius = 1; +this.outputEllipsoid(center, radius, coef, colix); +}, "JU.P3,~A,~N,~N,~N,~N,~N,JU.M3,~A,JU.M4,~A"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/export/___Exporter.js b/config/plugins/visualizations/jmol/static/j2s/J/export/___Exporter.js new file mode 100755 index 000000000000..ca04a9685d94 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/export/___Exporter.js @@ -0,0 +1,331 @@ +Clazz.declarePackage("J.export"); +Clazz.load(["JU.P3", "$.V3"], "J.export.___Exporter", ["java.util.Hashtable", "JU.AU", "$.Lst", "$.M3", "$.Quat", "$.SB", "JU.C", "$.Logger", "$.MeshSurface"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.solidOnly = false; +this.vwr = null; +this.tm = null; +this.privateKey = 0; +this.export3D = null; +this.out = null; +this.fileName = null; +this.commandLineOptions = null; +this.gdata = null; +this.backgroundColix = 0; +this.screenWidth = 0; +this.screenHeight = 0; +this.slabZ = 0; +this.depthZ = 0; +this.lightSource = null; +this.fixedRotationCenter = null; +this.referenceCenter = null; +this.cameraPosition = null; +this.cameraDistance = 0; +this.apertureAngle = 0; +this.scalePixelsPerAngstrom = 0; +this.exportScale = 1; +this.exportType = 0; +this.tempP1 = null; +this.tempP2 = null; +this.tempP3 = null; +this.center = null; +this.tempV1 = null; +this.tempV2 = null; +this.isWebGL = false; +this.commentChar = null; +this.tempC = null; +this.nText = 0; +this.nImage = 0; +this.lineWidthMad = 0; +Clazz.instantialize(this, arguments);}, J["export"], "___Exporter", null); +Clazz.prepareFields (c$, function(){ +this.tempP1 = new JU.P3(); +this.tempP2 = new JU.P3(); +this.tempP3 = new JU.P3(); +this.center = new JU.P3(); +this.tempV1 = new JU.V3(); +this.tempV2 = new JU.V3(); +this.tempC = new JU.P3(); +}); +Clazz.makeConstructor(c$, +function(){ +}); +Clazz.defineMethod(c$, "initializeOutput", +function(vwr, privateKey, gdata, params){ +return this.initOutput(vwr, privateKey, gdata, params); +}, "JV.Viewer,~N,JU.GData,java.util.Map"); +Clazz.defineMethod(c$, "initOutput", +function(vwr, privateKey, g3d, params){ +this.vwr = vwr; +this.tm = vwr.tm; +this.isWebGL = params.get("type").equals("JS"); +this.gdata = g3d; +this.privateKey = privateKey; +this.backgroundColix = vwr.getObjectColix(0); +this.center.setT(this.tm.fixedRotationCenter); +this.exportScale = vwr.getFloat(570425357); +if (this.exportScale == 0) { +this.exportScale = 10; +}JU.Logger.info("__Exporter exportScale: " + this.exportScale); +if ((this.screenWidth <= 0) || (this.screenHeight <= 0)) { +this.screenWidth = vwr.getScreenWidth(); +this.screenHeight = vwr.getScreenHeight(); +}this.slabZ = g3d.slab; +this.depthZ = g3d.depth; +this.lightSource = g3d.getLightSource(); +var cameraFactors = vwr.tm.getCameraFactors(); +this.referenceCenter = cameraFactors[0]; +this.cameraPosition = cameraFactors[1]; +this.fixedRotationCenter = cameraFactors[2]; +this.cameraDistance = cameraFactors[3].x; +this.apertureAngle = cameraFactors[3].y; +this.scalePixelsPerAngstrom = cameraFactors[3].z; +this.out = params.get("outputChannel"); +this.commandLineOptions = params.get("params"); +if (this.out != null) this.fileName = this.out.getFileName(); +this.outputHeader(); +return true; +}, "JV.Viewer,~N,JU.GData,java.util.Map"); +Clazz.defineMethod(c$, "output", +function(data){ +this.out.append(data); +}, "~S"); +Clazz.defineMethod(c$, "getByteCount", +function(){ +return this.out.getByteCount(); +}); +Clazz.defineMethod(c$, "outputComment", +function(comment){ +if (this.commentChar != null) this.output(this.commentChar + comment + "\n"); +}, "~S"); +c$.setTempVertex = Clazz.defineMethod(c$, "setTempVertex", +function(pt, offset, ptTemp){ +ptTemp.setT(pt); +if (offset != null) ptTemp.add(offset); +}, "JU.T3,JU.T3,JU.T3"); +Clazz.defineMethod(c$, "outputVertices", +function(vertices, nVertices, offset){ +for (var i = 0; i < nVertices; i++) { +if (Float.isNaN(vertices[i].x)) continue; +this.outputVertex(vertices[i], offset); +this.output("\n"); +} +}, "~A,~N,JU.T3"); +Clazz.defineMethod(c$, "outputVertex", +function(pt, offset){ +J["export"].___Exporter.setTempVertex(pt, offset, this.tempV1); +this.output(this.tempV1); +}, "JU.T3,JU.T3"); +Clazz.defineMethod(c$, "outputJmolPerspective", +function(){ +this.outputComment(this.getJmolPerspective()); +}); +Clazz.defineMethod(c$, "getJmolPerspective", +function(){ +if (this.commentChar == null) return ""; +var sb = new JU.SB(); +sb.append(this.commentChar).append("Jmol perspective:"); +sb.append("\n").append(this.commentChar).append("screen width height dim: " + this.screenWidth + " " + this.screenHeight + " " + this.vwr.getScreenDim()); +sb.append("\n").append(this.commentChar).append("perspectiveDepth: " + this.vwr.tm.perspectiveDepth); +sb.append("\n").append(this.commentChar).append("cameraDistance(angstroms): " + this.cameraDistance); +sb.append("\n").append(this.commentChar).append("aperatureAngle(degrees): " + this.apertureAngle); +sb.append("\n").append(this.commentChar).append("scalePixelsPerAngstrom: " + this.scalePixelsPerAngstrom); +sb.append("\n").append(this.commentChar).append("light source: " + this.lightSource); +sb.append("\n").append(this.commentChar).append("lighting: " + this.vwr.getLightingState().$replace('\n', ' ')); +sb.append("\n").append(this.commentChar).append("center: " + this.center); +sb.append("\n").append(this.commentChar).append("rotationRadius: " + this.vwr.getFloat(570425388)); +sb.append("\n").append(this.commentChar).append("boundboxCenter: " + this.vwr.getBoundBoxCenter()); +sb.append("\n").append(this.commentChar).append("translationOffset: " + this.tm.getTranslationScript()); +sb.append("\n").append(this.commentChar).append("zoom: " + this.vwr.tm.zmPct); +sb.append("\n").append(this.commentChar).append("moveto command: " + this.vwr.getOrientation(4129, null, null, null)); +sb.append("\n"); +return sb.toString(); +}); +Clazz.defineMethod(c$, "outputFooter", +function(){ +}); +Clazz.defineMethod(c$, "finalizeOutput", +function(){ +return this.finalizeOutput2(); +}); +Clazz.defineMethod(c$, "finalizeOutput2", +function(){ +this.outputFooter(); +if (this.out == null) return null; +var ret = this.out.closeChannel(); +if (this.fileName == null) return ret; +if (ret != null) { +JU.Logger.info(ret); +return "ERROR EXPORTING FILE: " + ret; +}return "OK " + this.out.getByteCount() + " " + this.export3D.getExportName() + " " + this.fileName; +}); +Clazz.defineMethod(c$, "getExportDate", +function(){ +return this.vwr.apiPlatform.getDateFormat(null); +}); +Clazz.defineMethod(c$, "rgbFractionalFromColix", +function(colix){ +return this.rgbFractionalFromArgb(this.gdata.getColorArgbOrGray(colix)); +}, "~N"); +Clazz.defineMethod(c$, "getTriadC", +function(t){ +return this.getTriad(t); +}, "JU.T3"); +Clazz.defineMethod(c$, "getTriad", +function(t){ +return J["export"].___Exporter.round(t.x) + " " + J["export"].___Exporter.round(t.y) + " " + J["export"].___Exporter.round(t.z); +}, "JU.T3"); +Clazz.defineMethod(c$, "rgbFractionalFromArgb", +function(argb){ +var red = (argb >> 16) & 0xFF; +var green = (argb >> 8) & 0xFF; +var blue = argb & 0xFF; +this.tempC.set(red == 0 ? 0 : (red + 1) / 256, green == 0 ? 0 : (green + 1) / 256, blue == 0 ? 0 : (blue + 1) / 256); +return this.getTriadC(this.tempC); +}, "~N"); +c$.translucencyFractionalFromColix = Clazz.defineMethod(c$, "translucencyFractionalFromColix", +function(colix){ +return J["export"].___Exporter.round(JU.C.getColixTranslucencyFractional(colix)); +}, "~N"); +c$.opacityFractionalFromColix = Clazz.defineMethod(c$, "opacityFractionalFromColix", +function(colix){ +return J["export"].___Exporter.round(1 - JU.C.getColixTranslucencyFractional(colix)); +}, "~N"); +c$.opacityFractionalFromArgb = Clazz.defineMethod(c$, "opacityFractionalFromArgb", +function(argb){ +var opacity = (argb >> 24) & 0xFF; +return J["export"].___Exporter.round(opacity == 0 ? 0 : (opacity + 1) / 256); +}, "~N"); +c$.round = Clazz.defineMethod(c$, "round", +function(number){ +var s; +return (number == 0 ? "0" : number == 1 ? "1" : (s = "" + (Math.round(number * 1000) / 1000)).startsWith("0.") ? s.substring(1) : s.startsWith("-0.") ? "-" + s.substring(2) : s.endsWith(".0") ? s.substring(0, s.length - 2) : s); +}, "~N"); +c$.round = Clazz.defineMethod(c$, "round", +function(pt){ +return J["export"].___Exporter.round(pt.x) + " " + J["export"].___Exporter.round(pt.y) + " " + J["export"].___Exporter.round(pt.z); +}, "JU.T3"); +Clazz.defineMethod(c$, "getColorList", +function(i00, colixes, nVertices, bsSelected, htColixes){ +var nColix = 0; +var list = new JU.Lst(); +var isAll = (bsSelected == null); +var i0 = (isAll ? nVertices - 1 : bsSelected.nextSetBit(0)); +for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsSelected.nextSetBit(i + 1))) { +var color = Short.$valueOf(colixes[i]); +if (!htColixes.containsKey(color)) { +list.addLast(color); +htColixes.put(color, Integer.$valueOf(i00 + nColix++)); +}} +return list; +}, "~N,~A,~N,JU.BS,java.util.Map"); +c$.getConeMesh = Clazz.defineMethod(c$, "getConeMesh", +function(centerBase, matRotateScale, colix){ +var ms = new JU.MeshSurface(); +var ndeg = 10; +var n = Clazz.doubleToInt(360 / ndeg); +ms.colix = colix; +ms.vs = new Array(ms.vc = n + 1); +ms.pis = JU.AU.newInt2(ms.pc = n); +for (var i = 0; i < n; i++) ms.pis[i] = Clazz.newIntArray(-1, [i, (i + 1) % n, n]); + +var d = ndeg / 180. * 3.141592653589793; +for (var i = 0; i < n; i++) { +var x = (Math.cos(i * d)); +var y = (Math.sin(i * d)); +ms.vs[i] = JU.P3.new3(x, y, 0); +} +ms.vs[n] = JU.P3.new3(0, 0, 1); +if (matRotateScale != null) { +ms.normals = new Array(ms.vc); +for (var i = 0; i < ms.vc; i++) { +matRotateScale.rotate(ms.vs[i]); +ms.normals[i] = JU.V3.newV(ms.vs[i]); +ms.normals[i].normalize(); +ms.vs[i].add(centerBase); +} +}return ms; +}, "JU.P3,JU.M3,~N"); +Clazz.defineMethod(c$, "getRotationMatrix", +function(pt1, pt2, radius){ +var m = new JU.M3(); +var m1; +if (pt2.x == pt1.x && pt2.y == pt1.y) { +m1 = JU.M3.newM3(null); +if (pt1.z > pt2.z) m1.m11 = m1.m22 = -1; +} else { +this.tempV1.sub2(pt2, pt1); +this.tempV2.set(0, 0, 1); +this.tempV2.cross(this.tempV2, this.tempV1); +this.tempV1.cross(this.tempV1, this.tempV2); +var q = JU.Quat.getQuaternionFrameV(this.tempV2, this.tempV1, null, false); +m1 = q.getMatrix(); +}m.m00 = radius; +m.m11 = radius; +m.m22 = pt2.distance(pt1); +m1.mul(m); +return m1; +}, "JU.P3,JU.P3,~N"); +Clazz.defineMethod(c$, "getRotationMatrix", +function(pt1, ptZ, radius, ptX, ptY){ +var m = new JU.M3(); +m.m00 = ptX.distance(pt1) * radius; +m.m11 = ptY.distance(pt1) * radius; +m.m22 = ptZ.distance(pt1) * 2; +var q = JU.Quat.getQuaternionFrame(pt1, ptX, ptY); +var m1 = q.getMatrix(); +m1.mul(m); +return m1; +}, "JU.P3,JU.P3,~N,JU.P3,JU.P3"); +Clazz.defineMethod(c$, "drawSurface", +function(meshSurface, colix){ +var nVertices = meshSurface.vc; +if (nVertices == 0) return; +var nTriangles = 0; +var nPolygons = meshSurface.pc; +var bsPolygons = meshSurface.bsPolygons; +var faceVertexMax = (meshSurface.haveQuads ? 4 : 3); +var indices = meshSurface.pis; +var isAll = (bsPolygons == null); +var i0 = (isAll ? nPolygons - 1 : bsPolygons.nextSetBit(0)); +for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsPolygons.nextSetBit(i + 1))) nTriangles += (faceVertexMax == 4 && indices[i].length == 4 ? 2 : 1); + +if (nTriangles == 0) return; +var vertices = meshSurface.getVertices(); +var normals = meshSurface.normals; +var colorSolid = (colix != 0); +var colixes = (colorSolid ? null : meshSurface.vcs); +var polygonColixes = (colorSolid ? meshSurface.pcs : null); +var htColixes = null; +var colorList = null; +if (!this.isWebGL) { +htColixes = new java.util.Hashtable(); +if (polygonColixes != null) colorList = this.getColorList(0, polygonColixes, nPolygons, bsPolygons, htColixes); + else if (colixes != null) colorList = this.getColorList(0, colixes, nVertices, null, htColixes); +}this.outputSurface(vertices, normals, colixes, indices, polygonColixes, nVertices, nPolygons, nTriangles, bsPolygons, faceVertexMax, colix, colorList, htColixes, meshSurface.offset); +}, "JU.MeshSurface,~N"); +Clazz.defineMethod(c$, "outputSurface", +function(vertices, normals, colixes, indices, polygonColixes, nVertices, nPolygons, nTriangles, bsPolygons, faceVertexMax, colix, colorList, htColixes, offset){ +}, "~A,~A,~A,~A,~A,~N,~N,~N,JU.BS,~N,~N,JU.Lst,java.util.Map,JU.P3"); +Clazz.defineMethod(c$, "drawFilledCircle", +function(colixRing, colixFill, diameter, x, y, z){ +if (colixRing != 0) this.drawCircle(x, y, z, diameter, colixRing, false); +if (colixFill != 0) this.drawCircle(x, y, z, diameter, colixFill, true); +}, "~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "fixScreenZ", +function(z){ +return (z <= 3 ? z + Clazz.floatToInt(this.tm.cameraDistance) : z); +}, "~N"); +Clazz.defineMethod(c$, "plotImage", +function(x, y, z, image, bgcolix, width, height){ +this.outputComment("start image " + (++this.nImage)); +this.gdata.plotImage(x, y, z, image, this.export3D, bgcolix, width, height); +this.outputComment("end image " + this.nImage); +}, "~N,~N,~N,~O,~N,~N,~N"); +Clazz.defineMethod(c$, "plotText", +function(x, y, z, colix, text, font3d){ +this.outputComment("start text " + (++this.nText) + ": " + text); +this.gdata.plotText(x, y, z, this.gdata.getColorArgbOrGray(colix), 0, text, font3d, this.export3D); +this.outputComment("end text " + this.nText + ": " + text); +}, "~N,~N,~N,~N,~S,JU.Font"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/CircleRenderer.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/CircleRenderer.js new file mode 100755 index 000000000000..b36153bf26de --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/CircleRenderer.js @@ -0,0 +1,154 @@ +Clazz.declarePackage("J.g3d"); +Clazz.load(["J.g3d.G3DRenderer"], "J.g3d.CircleRenderer", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.g3d = null; +Clazz.instantialize(this, arguments);}, J.g3d, "CircleRenderer", null, J.g3d.G3DRenderer); +/*LV!1824 unnec constructor*/Clazz.overrideMethod(c$, "set", +function(g3d, gdata){ +try { +this.g3d = g3d; +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +return this; +}, "J.api.JmolRendererInterface,JU.GData"); +Clazz.defineMethod(c$, "plotCircleCenteredClipped", +function(xCenter, yCenter, zCenter, diameter){ +var g = this.g3d; +var c = g.argbCurrent; +var width = g.width; +var zbuf = g.zbuf; +var p = g.pixel; +var r = Clazz.doubleToInt(diameter / 2); +var sizeCorrection = 1 - (diameter & 1); +var x = r; +var y = 0; +var xChange = 1 - 2 * r; +var yChange = 1; +var radiusError = 0; +while (x >= y) { +g.plotPixelClippedArgb(c, xCenter + x - sizeCorrection, yCenter + y - sizeCorrection, zCenter, width, zbuf, p); +g.plotPixelClippedArgb(c, xCenter + x - sizeCorrection, yCenter - y, zCenter, width, zbuf, p); +g.plotPixelClippedArgb(c, xCenter - x, yCenter + y - sizeCorrection, zCenter, width, zbuf, p); +g.plotPixelClippedArgb(c, xCenter - x, yCenter - y, zCenter, width, zbuf, p); +g.plotPixelClippedArgb(c, xCenter + y - sizeCorrection, yCenter + x - sizeCorrection, zCenter, width, zbuf, p); +g.plotPixelClippedArgb(c, xCenter + y - sizeCorrection, yCenter - x, zCenter, width, zbuf, p); +g.plotPixelClippedArgb(c, xCenter - y, yCenter + x - sizeCorrection, zCenter, width, zbuf, p); +g.plotPixelClippedArgb(c, xCenter - y, yCenter - x, zCenter, width, zbuf, p); +++y; +radiusError += yChange; +yChange += 2; +if (2 * radiusError + xChange > 0) { +--x; +radiusError += xChange; +xChange += 2; +}} +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "plotCircleCenteredUnclipped", +function(xCenter, yCenter, zCenter, diameter){ +var r = Clazz.doubleToInt(diameter / 2); +var sizeCorrection = 1 - (diameter & 1); +var x = r; +var y = 0; +var xChange = 1 - 2 * r; +var yChange = 1; +var radiusError = 0; +var g = this.g3d; +var p = g.pixel; +var width = g.width; +var zbuf = g.zbuf; +var c = g.argbCurrent; +while (x >= y) { +g.plotPixelUnclipped(c, xCenter + x - sizeCorrection, yCenter + y - sizeCorrection, zCenter, width, zbuf, p); +g.plotPixelUnclipped(c, xCenter + x - sizeCorrection, yCenter - y, zCenter, width, zbuf, p); +g.plotPixelUnclipped(c, xCenter - x, yCenter + y - sizeCorrection, zCenter, width, zbuf, p); +g.plotPixelUnclipped(c, xCenter - x, yCenter - y, zCenter, width, zbuf, p); +g.plotPixelUnclipped(c, xCenter + y - sizeCorrection, yCenter + x - sizeCorrection, zCenter, width, zbuf, p); +g.plotPixelUnclipped(c, xCenter + y - sizeCorrection, yCenter - x, zCenter, width, zbuf, p); +g.plotPixelUnclipped(c, xCenter - y, yCenter + x - sizeCorrection, zCenter, width, zbuf, p); +g.plotPixelUnclipped(c, xCenter - y, yCenter - x, zCenter, width, zbuf, p); +++y; +radiusError += yChange; +yChange += 2; +if (2 * radiusError + xChange > 0) { +--x; +radiusError += xChange; +xChange += 2; +}} +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "plotFilledCircleCenteredClipped", +function(xCenter, yCenter, zCenter, diameter){ +var r = Clazz.doubleToInt(diameter / 2); +var sizeCorrection = 1 - (diameter & 1); +var x = r; +var y = 0; +var xChange = 1 - 2 * r; +var yChange = 1; +var radiusError = 0; +var g = this.g3d; +var c = g.argbCurrent; +var width = g.width; +var height = g.height; +var zbuf = g.zbuf; +var p = g.pixel; +while (x >= y) { +this.plotPixelsClipped(c, 2 * x + 1 - sizeCorrection, xCenter - x, yCenter + y - sizeCorrection, zCenter, width, height, zbuf, p); +this.plotPixelsClipped(c, 2 * x + 1 - sizeCorrection, xCenter - x, yCenter - y, zCenter, width, height, zbuf, p); +this.plotPixelsClipped(c, 2 * y + 1 - sizeCorrection, xCenter - y, yCenter + x - sizeCorrection, zCenter, width, height, zbuf, p); +this.plotPixelsClipped(c, 2 * y + 1 - sizeCorrection, xCenter - y, yCenter - x, zCenter, width, height, zbuf, p); +++y; +radiusError += yChange; +yChange += 2; +if (2 * radiusError + xChange > 0) { +--x; +radiusError += xChange; +xChange += 2; +}} +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "plotPixelsClipped", +function(argb, count, x, y, z, width, height, zbuf, p){ +if (y < 0 || y >= height || x >= width) return; +if (x < 0) { +count += x; +x = 0; +}if (count + x > width) count = width - x; +if (count <= 0) return; +var offsetPbuf = y * width + x; +var offsetMax = offsetPbuf + count; +while (offsetPbuf < offsetMax) { +if (z < zbuf[offsetPbuf]) p.addPixel(offsetPbuf, z, argb); +offsetPbuf++; +} +}, "~N,~N,~N,~N,~N,~N,~N,~A,J.g3d.Pixelator"); +Clazz.defineMethod(c$, "plotFilledCircleCenteredUnclipped", +function(xCenter, yCenter, zCenter, diameter){ +var r = Clazz.doubleToInt(diameter / 2); +var x = r; +var y = 0; +var xChange = 1 - 2 * r; +var yChange = 1; +var radiusError = 0; +var g = this.g3d; +var c = g.argbCurrent; +var width = g.width; +var zbuf = g.zbuf; +var p = g.pixel; +while (x >= y) { +g.plotPixelsUnclippedCount(c, 2 * x + 1, xCenter - x, yCenter + y, zCenter, width, zbuf, p); +g.plotPixelsUnclippedCount(c, 2 * x + 1, xCenter - x, yCenter - y, zCenter, width, zbuf, p); +g.plotPixelsUnclippedCount(c, 2 * y + 1, xCenter - y, yCenter + x, zCenter, width, zbuf, p); +g.plotPixelsUnclippedCount(c, 2 * y + 1, xCenter - y, yCenter - x, zCenter, width, zbuf, p); +++y; +radiusError += yChange; +yChange += 2; +if (2 * radiusError + xChange > 0) { +--x; +radiusError += xChange; +xChange += 2; +}} +}, "~N,~N,~N,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/CylinderRenderer.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/CylinderRenderer.js new file mode 100755 index 000000000000..6435bd140517 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/CylinderRenderer.js @@ -0,0 +1,603 @@ +Clazz.declarePackage("J.g3d"); +Clazz.load(["JU.P3i"], "J.g3d.CylinderRenderer", ["JU.AU", "$.P3"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.g3d = null; +this.line3d = null; +this.shader = null; +this.colixA = 0; +this.colixB = 0; +this.shadesA = null; +this.shadesB = null; +this.xA = 0; +this.yA = 0; +this.zA = 0; +this.xAend = 0; +this.yAend = 0; +this.zAend = 0; +this.dxB = 0; +this.dyB = 0; +this.dzB = 0; +this.xAf = 0; +this.yAf = 0; +this.zAf = 0; +this.dxBf = 0; +this.dyBf = 0; +this.dzBf = 0; +this.tEvenDiameter = false; +this.diameter = 0; +this.endcaps = 0; +this.endCapHidden = false; +this.xEndcap = 0; +this.yEndcap = 0; +this.zEndcap = 0; +this.argbEndcap = 0; +this.colixEndcap = 0; +this.endcapShadeIndex = 0; +this.radius = 0; +this.radius2 = 0; +this.cosTheta = 0; +this.cosPhi = 0; +this.sinPhi = 0; +this.clipped = false; +this.rasterCount = 0; +this.xyztRaster = null; +this.xyzfRaster = null; +this.ptA0 = null; +this.ptB0 = null; +this.ptA0i = null; +this.ptB0i = null; +this.xTip = 0; +this.yTip = 0; +this.zTip = 0; +Clazz.instantialize(this, arguments);}, J.g3d, "CylinderRenderer", null); +Clazz.prepareFields (c$, function(){ +this.xyztRaster = Clazz.newArray(-1, [ Clazz.newFloatArray (32, 0), Clazz.newFloatArray (32, 0), Clazz.newFloatArray (32, 0), Clazz.newFloatArray (32, 0)]); +this.xyzfRaster = Clazz.newArray(-1, [ Clazz.newIntArray (32, 0), Clazz.newIntArray (32, 0), Clazz.newIntArray (32, 0), Clazz.newIntArray (32, 0)]); +this.ptA0i = new JU.P3i(); +this.ptB0i = new JU.P3i(); +}); +Clazz.makeConstructor(c$, +function(g3d){ +this.g3d = g3d; +this.line3d = g3d.line3d; +this.shader = g3d.shader; +}, "J.g3d.Graphics3D"); +Clazz.defineMethod(c$, "renderOld", +function(colixA, colixB, screen, endcaps, diameter, xa, ya, za, xb, yb, zb){ +var r = Clazz.doubleToInt(diameter / 2) + 1; +var g = this.g3d; +var codeMinA = g.clipCode3(xa - r, ya - r, za - r); +var codeMaxA = g.clipCode3(xa + r, ya + r, za + r); +var codeMinB = g.clipCode3(xb - r, yb - r, zb - r); +var codeMaxB = g.clipCode3(xb + r, yb + r, zb + r); +var c = (codeMinA | codeMaxA | codeMinB | codeMaxB); +this.clipped = (c != 0); +if (c == -1 || (codeMinA & codeMaxB & codeMaxA & codeMinB) != 0) return; +this.dxB = xb - xa; +this.dyB = yb - ya; +this.dzB = zb - za; +if (diameter <= 1) { +this.line3d.plotLineDeltaOld(g.getColorArgbOrGray(colixA), g.getColorArgbOrGray(colixB), xa, ya, za, this.dxB, this.dyB, this.dzB, this.clipped); +return; +}var drawBackside = (screen == 0 && (this.clipped || endcaps == 2 || endcaps == 0)); +this.diameter = diameter; +this.xA = xa; +this.yA = ya; +this.zA = za; +this.endcaps = endcaps; +this.shadesA = g.getShades(this.colixA = colixA); +this.shadesB = g.getShades(this.colixB = colixB); +this.calcArgbEndcap(true, false); +this.calcCosSin(this.dxB, this.dyB, this.dzB); +this.calcPoints(3, false); +this.interpolate(0, 1, this.xyzfRaster, this.xyztRaster); +this.interpolate(1, 2, this.xyzfRaster, this.xyztRaster); +var xyzf = this.xyzfRaster; +if (endcaps == 2) this.renderFlatEndcap(true, false, xyzf); +g.setZMargin(5); +var width = g.width; +var zbuf = g.zbuf; +var xr = xyzf[0]; +var yr = xyzf[1]; +var zr = xyzf[2]; +var fr = xyzf[3]; +var p = g.pixel; +for (var i = this.rasterCount; --i >= 0; ) { +var fpz = fr[i] >> (8); +var fpzBack = fpz >> 1; +var x = xr[i]; +var y = yr[i]; +var z = zr[i]; +if (this.endCapHidden && this.argbEndcap != 0) { +if (this.clipped) { +g.plotPixelClippedArgb(this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p); +g.plotPixelClippedArgb(this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p); +} else { +g.plotPixelUnclipped(this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p); +g.plotPixelUnclipped(this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p); +}}this.line3d.plotLineDeltaAOld(this.shadesA, this.shadesB, screen, fpz, this.xA + x, this.yA + y, this.zA - z, this.dxB, this.dyB, this.dzB, this.clipped); +if (drawBackside) { +this.line3d.plotLineDeltaOld(this.shadesA[fpzBack], this.shadesB[fpzBack], this.xA - x, this.yA - y, this.zA + z, this.dxB, this.dyB, this.dzB, this.clipped); +}} +g.setZMargin(0); +if (endcaps == 3) this.renderSphericalEndcaps(); +}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "renderBitsFloat", +function(colixA, colixB, screen, endcaps, diameter, ptA, ptB){ +var g = this.g3d; +if (this.ptA0 == null) { +this.ptA0 = new JU.P3(); +this.ptB0 = new JU.P3(); +}this.ptA0.setT(ptA); +var r = Clazz.doubleToInt(diameter / 2) + 1; +var ixA = Math.round(ptA.x); +var iyA = Math.round(ptA.y); +var izA = Math.round(ptA.z); +var ixB = Math.round(ptB.x); +var iyB = Math.round(ptB.y); +var izB = Math.round(ptB.z); +var codeMinA = g.clipCode3(ixA - r, iyA - r, izA - r); +var codeMaxA = g.clipCode3(ixA + r, iyA + r, izA + r); +var codeMinB = g.clipCode3(ixB - r, iyB - r, izB - r); +var codeMaxB = g.clipCode3(ixB + r, iyB + r, izB + r); +var c = (codeMinA | codeMaxA | codeMinB | codeMaxB); +this.clipped = (c != 0); +if (c == -1 || (codeMinA & codeMaxB & codeMaxA & codeMinB) != 0) return; +this.dxBf = ptB.x - ptA.x; +this.dyBf = ptB.y - ptA.y; +this.dzBf = ptB.z - ptA.z; +if (diameter > 0) { +this.diameter = diameter; +this.xAf = ptA.x; +this.yAf = ptA.y; +this.zAf = ptA.z; +}var drawBackside = (screen == 0 && (this.clipped || endcaps == 2 || endcaps == 0)); +this.xA = Clazz.floatToInt(this.xAf); +this.yA = Clazz.floatToInt(this.yAf); +this.zA = Clazz.floatToInt(this.zAf); +this.dxB = Clazz.floatToInt(this.dxBf); +this.dyB = Clazz.floatToInt(this.dyBf); +this.dzB = Clazz.floatToInt(this.dzBf); +this.shadesA = g.getShades(this.colixA = colixA); +this.shadesB = g.getShades(this.colixB = colixB); +this.endcaps = endcaps; +this.calcArgbEndcap(true, true); +var xyzf = this.xyzfRaster; +if (diameter > 0) this.generateBaseEllipsePrecisely(false); +if (endcaps == 2) this.renderFlatEndcap(true, true, xyzf); +this.line3d.setLineBits(this.dxBf, this.dyBf); +g.setZMargin(5); +var p = g.pixel; +var width = g.width; +var zbuf = g.zbuf; +var xr = xyzf[0]; +var yr = xyzf[1]; +var zr = xyzf[2]; +var fr = xyzf[3]; +for (var i = this.rasterCount; --i >= 0; ) { +var fpz = fr[i] >> (8); +var fpzBack = fpz >> 1; +var x = xr[i]; +var y = yr[i]; +var z = zr[i]; +if (this.endCapHidden && this.argbEndcap != 0) { +if (this.clipped) { +g.plotPixelClippedArgb(this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p); +g.plotPixelClippedArgb(this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p); +} else { +g.plotPixelUnclipped(this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p); +g.plotPixelUnclipped(this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p); +}}this.ptA0.set(this.xA + x, this.yA + y, this.zA - z); +this.ptB0.setT(this.ptA0); +this.ptB0.x += this.dxB; +this.ptB0.y += this.dyB; +this.ptB0.z += this.dzB; +this.line3d.plotLineDeltaABitsFloat(this.shadesA, this.shadesB, fpz, this.ptA0, this.ptB0, screen, this.clipped); +if (drawBackside) { +this.ptA0.set(this.xA - x, this.yA - y, this.zA + z); +this.ptB0.setT(this.ptA0); +this.ptB0.x += this.dxB; +this.ptB0.y += this.dyB; +this.ptB0.z += this.dzB; +this.line3d.plotLineDeltaABitsFloat(this.shadesA, this.shadesB, fpzBack, this.ptA0, this.ptB0, screen, this.clipped); +}} +g.setZMargin(0); +if (endcaps == 3) this.renderSphericalEndcaps(); +this.xAf += this.dxBf; +this.yAf += this.dyBf; +this.zAf += this.dzBf; +}, "~N,~N,~N,~N,~N,JU.P3,JU.P3"); +Clazz.defineMethod(c$, "renderBits", +function(colixA, colixB, screen, endcaps, diameter, ptA, ptB){ +var g = this.g3d; +if (diameter == 0 || diameter == 1) { +this.line3d.plotLineBits(g.getColorArgbOrGray(colixA), g.getColorArgbOrGray(colixB), ptA, ptB, 0, 0, false); +return; +}this.ptA0i.setT(ptA); +var r = Clazz.doubleToInt(diameter / 2) + 1; +var ixA = ptA.x; +var iyA = ptA.y; +var izA = ptA.z; +var ixB = ptB.x; +var iyB = ptB.y; +var izB = ptB.z; +var codeMinA = g.clipCode3(ixA - r, iyA - r, izA - r); +var codeMaxA = g.clipCode3(ixA + r, iyA + r, izA + r); +var codeMinB = g.clipCode3(ixB - r, iyB - r, izB - r); +var codeMaxB = g.clipCode3(ixB + r, iyB + r, izB + r); +var c = (codeMinA | codeMaxA | codeMinB | codeMaxB); +this.clipped = (c != 0); +if (c == -1 || (codeMinA & codeMaxB & codeMaxA & codeMinB) != 0) return; +this.dxBf = ptB.x - ptA.x; +this.dyBf = ptB.y - ptA.y; +this.dzBf = ptB.z - ptA.z; +if (diameter > 0) { +this.diameter = diameter; +this.xAf = ptA.x; +this.yAf = ptA.y; +this.zAf = ptA.z; +}var drawBackside = (screen == 0 && (this.clipped || endcaps == 2 || endcaps == 0)); +this.xA = Clazz.floatToInt(this.xAf); +this.yA = Clazz.floatToInt(this.yAf); +this.zA = Clazz.floatToInt(this.zAf); +this.dxB = Clazz.floatToInt(this.dxBf); +this.dyB = Clazz.floatToInt(this.dyBf); +this.dzB = Clazz.floatToInt(this.dzBf); +this.shadesA = g.getShades(this.colixA = colixA); +this.shadesB = g.getShades(this.colixB = colixB); +this.endcaps = endcaps; +this.calcArgbEndcap(true, true); +var xyzf = this.xyzfRaster; +if (diameter > 0) this.generateBaseEllipsePrecisely(false); +if (endcaps == 2) this.renderFlatEndcap(true, true, xyzf); +this.line3d.setLineBits(this.dxBf, this.dyBf); +g.setZMargin(5); +var p = g.pixel; +var width = g.width; +var zbuf = g.zbuf; +var xr = xyzf[0]; +var yr = xyzf[1]; +var zr = xyzf[2]; +var fr = xyzf[3]; +for (var i = this.rasterCount; --i >= 0; ) { +var fpz = fr[i] >> (8); +var fpzBack = fpz >> 1; +var x = xr[i]; +var y = yr[i]; +var z = zr[i]; +if (this.endCapHidden && this.argbEndcap != 0) { +if (this.clipped) { +g.plotPixelClippedArgb(this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p); +g.plotPixelClippedArgb(this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p); +} else { +g.plotPixelUnclipped(this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p); +g.plotPixelUnclipped(this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p); +}}this.ptA0i.set(this.xA + x, this.yA + y, this.zA - z); +this.ptB0i.setT(this.ptA0i); +this.ptB0i.x += this.dxB; +this.ptB0i.y += this.dyB; +this.ptB0i.z += this.dzB; +this.line3d.plotLineDeltaABitsInt(this.shadesA, this.shadesB, fpz, this.ptA0i, this.ptB0i, screen, this.clipped); +if (drawBackside) { +this.ptA0i.set(this.xA - x, this.yA - y, this.zA + z); +this.ptB0i.setT(this.ptA0i); +this.ptB0i.x += this.dxB; +this.ptB0i.y += this.dyB; +this.ptB0i.z += this.dzB; +this.line3d.plotLineDeltaABitsInt(this.shadesA, this.shadesB, fpzBack, this.ptA0i, this.ptB0i, screen, this.clipped); +}} +g.setZMargin(0); +if (endcaps == 3) this.renderSphericalEndcaps(); +this.xAf += this.dxBf; +this.yAf += this.dyBf; +this.zAf += this.dzBf; +}, "~N,~N,~N,~N,~N,JU.P3i,JU.P3i"); +Clazz.defineMethod(c$, "renderConeOld", +function(colix, endcap, diameter, xa, ya, za, xtip, ytip, ztip, doFill, isBarb){ +this.dxBf = (xtip) - (this.xAf = xa); +this.dyBf = (ytip) - (this.yAf = ya); +this.dzBf = (ztip) - (this.zAf = za); +this.xA = Clazz.doubleToInt(Math.floor(this.xAf)); +this.yA = Clazz.doubleToInt(Math.floor(this.yAf)); +this.zA = Clazz.doubleToInt(Math.floor(this.zAf)); +this.dxB = Clazz.doubleToInt(Math.floor(this.dxBf)); +this.dyB = Clazz.doubleToInt(Math.floor(this.dyBf)); +this.dzB = Clazz.doubleToInt(Math.floor(this.dzBf)); +this.xTip = xtip; +this.yTip = ytip; +this.zTip = ztip; +this.shadesA = this.g3d.getShades(this.colixA = colix); +var shadeIndexTip = this.shader.getShadeIndex(this.dxB, this.dyB, -this.dzB); +var g3d = this.g3d; +var p = g3d.pixel; +var width = g3d.width; +var zbuf = g3d.zbuf; +g3d.plotPixelClippedArgb(this.shadesA[shadeIndexTip], Clazz.floatToInt(xtip), Clazz.floatToInt(ytip), Clazz.floatToInt(ztip), width, zbuf, p); +this.diameter = diameter; +if (diameter <= 1) { +if (diameter == 1) this.line3d.plotLineDeltaOld(this.colixA, this.colixA, this.xA, this.yA, this.zA, this.dxB, this.dyB, this.dzB, this.clipped); +return; +}this.endcaps = endcap; +this.calcArgbEndcap(false, true); +this.generateBaseEllipsePrecisely(isBarb); +if (!isBarb && this.endcaps == 2) this.renderFlatEndcap(false, true, this.xyzfRaster); +g3d.setZMargin(5); +var xr = this.xyztRaster[0]; +var yr = this.xyztRaster[1]; +var zr = this.xyztRaster[2]; +var fr = this.xyzfRaster[3]; +var sA = this.shadesA; +var doOpen = (this.endCapHidden && this.argbEndcap != 0); +for (var i = this.rasterCount; --i >= 0; ) { +var x = xr[i]; +var y = yr[i]; +var z = zr[i]; +var fpz = fr[i] >> (8); +var xUp = this.xAf + x; +var yUp = this.yAf + y; +var zUp = this.zAf - z; +var xDn = this.xAf - x; +var yDn = this.yAf - y; +var zDn = this.zAf + z; +var argb = sA[0]; +if (doOpen) { +g3d.plotPixelClippedArgb(this.argbEndcap, Clazz.floatToInt(xUp), Clazz.floatToInt(yUp), Clazz.floatToInt(zUp), width, zbuf, p); +g3d.plotPixelClippedArgb(this.argbEndcap, Clazz.floatToInt(xDn), Clazz.floatToInt(yDn), Clazz.floatToInt(zDn), width, zbuf, p); +}if (argb != 0) { +this.line3d.plotLineDeltaAOld(sA, sA, 0, fpz, Clazz.floatToInt(xUp), Clazz.floatToInt(yUp), Clazz.floatToInt(zUp), Clazz.doubleToInt(Math.ceil(this.xTip - xUp)), Clazz.doubleToInt(Math.ceil(this.yTip - yUp)), Clazz.doubleToInt(Math.ceil(this.zTip - zUp)), true); +if (doFill) { +this.line3d.plotLineDeltaAOld(sA, sA, 0, fpz, Clazz.floatToInt(xUp), Clazz.floatToInt(yUp) + 1, Clazz.floatToInt(zUp), Clazz.doubleToInt(Math.ceil(this.xTip - xUp)), Clazz.doubleToInt(Math.ceil(this.yTip - yUp)) + 1, Clazz.doubleToInt(Math.ceil(this.zTip - zUp)), true); +this.line3d.plotLineDeltaAOld(sA, sA, 0, fpz, Clazz.floatToInt(xUp) + 1, Clazz.floatToInt(yUp), Clazz.floatToInt(zUp), Clazz.doubleToInt(Math.ceil(this.xTip - xUp)) + 1, Clazz.doubleToInt(Math.ceil(this.yTip - yUp)), Clazz.doubleToInt(Math.ceil(this.zTip - zUp)), true); +}if (!isBarb && !(this.endcaps != 2 && this.dzB > 0)) { +this.line3d.plotLineDeltaOld(argb, argb, Clazz.floatToInt(xDn), Clazz.floatToInt(yDn), Clazz.floatToInt(zDn), Clazz.doubleToInt(Math.ceil(this.xTip - xDn)), Clazz.doubleToInt(Math.ceil(this.yTip - yDn)), Clazz.doubleToInt(Math.ceil(this.zTip - zDn)), true); +}}} +g3d.setZMargin(0); +}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~B,~B"); +Clazz.defineMethod(c$, "generateBaseEllipsePrecisely", +function(isBarb){ +this.calcCosSin(this.dxBf, this.dyBf, this.dzBf); +this.calcPoints(isBarb ? 2 : 3, true); +this.interpolatePrecisely(0, 1, this.xyzfRaster, this.xyztRaster); +if (!isBarb) this.interpolatePrecisely(1, 2, this.xyzfRaster, this.xyztRaster); +for (var i = 3; --i >= 0; ) for (var j = this.rasterCount; --j >= 0; ) this.xyzfRaster[i][j] = Clazz.doubleToInt(Math.floor(this.xyztRaster[i][j])); + + +}, "~B"); +Clazz.defineMethod(c$, "calcPoints", +function(count, isPrecise){ +this.calcRotatedPoint(0, 0, isPrecise, this.xyzfRaster, this.xyztRaster); +this.calcRotatedPoint(0.5, 1, isPrecise, this.xyzfRaster, this.xyztRaster); +if ((this.rasterCount = count) == 3) this.calcRotatedPoint(1, 2, isPrecise, this.xyzfRaster, this.xyztRaster); +}, "~N,~B"); +Clazz.defineMethod(c$, "calcCosSin", +function(dx, dy, dz){ +var mag2d2 = dx * dx + dy * dy; +if (mag2d2 == 0) { +this.cosTheta = 1; +this.cosPhi = 1; +this.sinPhi = 0; +} else { +var mag2d = Math.sqrt(mag2d2); +var mag3d = Math.sqrt(mag2d2 + dz * dz); +this.cosTheta = dz / mag3d; +this.cosPhi = dx / mag2d; +this.sinPhi = dy / mag2d; +}}, "~N,~N,~N"); +Clazz.defineMethod(c$, "calcRotatedPoint", +function(t, i, isPrecision, xyzf, xyzt){ +xyzt[3][i] = t; +var tPI = t * 3.141592653589793; +var xT = Math.sin(tPI) * this.cosTheta; +var yT = Math.cos(tPI); +var xR = this.radius * (xT * this.cosPhi - yT * this.sinPhi); +var yR = this.radius * (xT * this.sinPhi + yT * this.cosPhi); +var z2 = this.radius2 - (xR * xR + yR * yR); +var zR = (z2 > 0 ? Math.sqrt(z2) : 0); +if (isPrecision) { +xyzt[0][i] = xR; +xyzt[1][i] = yR; +xyzt[2][i] = zR; +} else if (this.tEvenDiameter) { +xyzf[0][i] = Clazz.doubleToInt(xR - 0.5); +xyzf[1][i] = Clazz.doubleToInt(yR - 0.5); +xyzf[2][i] = Clazz.doubleToInt(zR + 0.5); +} else { +xyzf[0][i] = Clazz.doubleToInt(xR); +xyzf[1][i] = Clazz.doubleToInt(yR); +xyzf[2][i] = Clazz.doubleToInt(zR + 0.5); +}xyzf[3][i] = this.shader.getShadeFp8(xR, yR, zR); +}, "~N,~N,~B,~A,~A"); +Clazz.defineMethod(c$, "allocRaster", +function(isPrecision, xyzf, xyzt){ +if (this.rasterCount >= xyzf[0].length) while (this.rasterCount >= xyzf[0].length) { +for (var i = 4; --i >= 0; ) xyzf[i] = JU.AU.doubleLengthI(xyzf[i]); + +xyzt[3] = JU.AU.doubleLengthF(xyzt[3]); +} +if (isPrecision) while (this.rasterCount >= xyzt[0].length) { +for (var i = 3; --i >= 0; ) xyzt[i] = JU.AU.doubleLengthF(xyzt[i]); + +} +return this.rasterCount++; +}, "~B,~A,~A"); +Clazz.defineMethod(c$, "interpolate", +function(iLower, iUpper, xyzf, xyzt){ +var x = xyzf[0]; +var y = xyzf[1]; +var dx = x[iUpper] - x[iLower]; +if (dx < 0) dx = -dx; +var dy = y[iUpper] - y[iLower]; +if (dy < 0) dy = -dy; +if ((dx + dy) <= 1) return; +var iMid = this.allocRaster(false, xyzf, xyzt); +x = xyzf[0]; +y = xyzf[1]; +var f = xyzf[3]; +var tLower = xyzt[3][iLower]; +var tUpper = xyzt[3][iUpper]; +for (var j = 4; --j >= 0; ) { +var tMid = (tLower + tUpper) / 2; +this.calcRotatedPoint(tMid, iMid, false, xyzf, xyzt); +if ((x[iMid] == x[iLower]) && (y[iMid] == y[iLower])) { +f[iLower] = (f[iLower] + f[iMid]) >>> 1; +tLower = tMid; +} else if ((x[iMid] == x[iUpper]) && (y[iMid] == y[iUpper])) { +f[iUpper] = (f[iUpper] + f[iMid]) >>> 1; +tUpper = tMid; +} else { +this.interpolate(iLower, iMid, xyzf, xyzt); +this.interpolate(iMid, iUpper, xyzf, xyzt); +return; +}} +x[iMid] = x[iLower]; +y[iMid] = y[iUpper]; +}, "~N,~N,~A,~A"); +Clazz.defineMethod(c$, "interpolatePrecisely", +function(iLower, iUpper, xyzf, xyzt){ +var x = xyzt[0]; +var y = xyzt[1]; +var dx = Clazz.doubleToInt(Math.floor(x[iUpper])) - Clazz.doubleToInt(Math.floor(x[iLower])); +if (dx < 0) dx = -dx; +var dy = Clazz.doubleToInt(Math.floor(y[iUpper])) - Clazz.doubleToInt(Math.floor(y[iLower])); +if (dy < 0) dy = -dy; +if ((dx + dy) <= 1) return; +var t = xyzt[3]; +var tLower = t[iLower]; +var tUpper = t[iUpper]; +var iMid = this.allocRaster(true, xyzf, xyzt); +x = xyzt[0]; +y = xyzt[1]; +t = xyzt[3]; +var f = xyzf[3]; +for (var j = 4; --j >= 0; ) { +var tMid = (tLower + tUpper) / 2; +this.calcRotatedPoint(tMid, iMid, true, xyzf, xyzt); +if ((Clazz.doubleToInt(Math.floor(x[iMid])) == Clazz.doubleToInt(Math.floor(x[iLower]))) && (Clazz.doubleToInt(Math.floor(y[iMid])) == Clazz.doubleToInt(Math.floor(y[iLower])))) { +f[iLower] = (f[iLower] + f[iMid]) >>> 1; +tLower = tMid; +} else if ((Clazz.doubleToInt(Math.floor(x[iMid])) == Clazz.doubleToInt(Math.floor(x[iUpper]))) && (Clazz.doubleToInt(Math.floor(y[iMid])) == Clazz.doubleToInt(Math.floor(y[iUpper])))) { +f[iUpper] = (f[iUpper] + f[iMid]) >>> 1; +tUpper = tMid; +} else { +this.interpolatePrecisely(iLower, iMid, xyzf, xyzt); +this.interpolatePrecisely(iMid, iUpper, xyzf, xyzt); +return; +}} +x[iMid] = x[iLower]; +y[iMid] = y[iUpper]; +}, "~N,~N,~A,~A"); +Clazz.defineMethod(c$, "renderFlatEndcap", +function(isCylinder, isPrecise, xyzf){ +var xT; +var yT; +var zT; +if (isPrecise) { +if (this.dzBf == 0 || this.colixEndcap == 0 || !this.g3d.setC(this.colixEndcap)) return; +var xTf = this.xAf; +var yTf = this.yAf; +var zTf = this.zAf; +if (isCylinder && this.dzBf < 0) { +xTf += this.dxBf; +yTf += this.dyBf; +zTf += this.dzBf; +}xT = Clazz.floatToInt(xTf); +yT = Clazz.floatToInt(yTf); +zT = Clazz.floatToInt(zTf); +} else { +if (this.dzB == 0 || this.colixEndcap == 0 || !this.g3d.setC(this.colixEndcap)) return; +xT = this.xAend; +yT = this.yAend; +zT = this.zAend; +if (isCylinder && this.dzB < 0) { +xT += this.dxB; +yT += this.dyB; +zT += this.dzB; +}}var yMin = xyzf[1][0]; +var yMax = xyzf[1][0]; +var zXMin = 0; +var zXMax = 0; +var xr = xyzf[0]; +var yr = xyzf[1]; +var zr = xyzf[2]; +for (var i = this.rasterCount; --i > 0; ) { +var y = yr[i]; +if (y < yMin) yMin = y; + else if (y > yMax) yMax = y; + else { +y = -y; +if (y < yMin) yMin = y; + else if (y > yMax) yMax = y; +}} +for (var y = yMin; y <= yMax; ++y) { +var xMin = 2147483647; +var xMax = -2147483648; +for (var i = this.rasterCount; --i >= 0; ) { +if (yr[i] == y) { +var x = xr[i]; +if (x < xMin) { +xMin = x; +zXMin = zr[i]; +}if (x > xMax) { +xMax = x; +zXMax = zr[i]; +}}if (yr[i] == -y) { +var x = -xr[i]; +if (x < xMin) { +xMin = x; +zXMin = -zr[i]; +}if (x > xMax) { +xMax = x; +zXMax = -zr[i]; +}}} +var count = xMax - xMin + 1; +this.g3d.setColorNoisy(this.endcapShadeIndex); +this.g3d.plotPixelsClippedRaster(count, xT + xMin, yT + y, zT - zXMin - 1, zT - zXMax - 1, null, null); +} +}, "~B,~B,~A"); +Clazz.defineMethod(c$, "renderSphericalEndcaps", +function(){ +if (this.colixA != 0 && this.g3d.setC(this.colixA)) this.g3d.fillSphereXYZ(this.diameter, this.xA, this.yA, this.zA + 1); +if (this.colixB != 0 && this.g3d.setC(this.colixB)) this.g3d.fillSphereXYZ(this.diameter, this.xA + this.dxB, this.yA + this.dyB, this.zA + this.dzB + 1); +}); +Clazz.defineMethod(c$, "calcArgbEndcap", +function(tCylinder, isFloat){ +this.tEvenDiameter = ((this.diameter & 1) == 0); +this.radius = this.diameter / 2.0; +this.radius2 = this.radius * this.radius; +this.endCapHidden = false; +var dzf = (isFloat ? this.dzBf : this.dzB); +if (this.endcaps == 3 || dzf == 0) return; +this.xEndcap = this.xAend = this.xA; +this.yEndcap = this.yAend = this.yA; +this.zEndcap = this.zAend = this.zA; +var shadesEndcap; +var dxf = (isFloat ? this.dxBf : this.dxB); +var dyf = (isFloat ? this.dyBf : this.dyB); +if (dzf >= 0 || !tCylinder) { +this.endcapShadeIndex = this.shader.getShadeIndex(-dxf, -dyf, dzf); +if (this.colixA == 0) { +this.xAend += Clazz.doubleToInt(this.dxB / 2); +this.yAend += Clazz.doubleToInt(this.dyB / 2); +this.zAend += Clazz.doubleToInt(this.dzB / 2); +this.colixEndcap = this.colixB; +} else { +this.colixEndcap = this.colixA; +}} else { +this.endcapShadeIndex = this.shader.getShadeIndex(dxf, dyf, -dzf); +if (this.colixB == 0) { +this.colixEndcap = this.colixA; +this.xAend -= Clazz.doubleToInt(this.dxB / 2); +this.yAend -= Clazz.doubleToInt(this.dyB / 2); +this.zAend -= Clazz.doubleToInt(this.dzB / 2); +} else { +this.colixEndcap = this.colixB; +this.xEndcap += this.dxB; +this.yEndcap += this.dyB; +this.zEndcap += this.dzB; +}}shadesEndcap = (this.colixEndcap == this.colixA ? this.shadesA : this.shadesB); +if (this.endcapShadeIndex > 56) this.endcapShadeIndex = 56; +this.argbEndcap = shadesEndcap[this.endcapShadeIndex]; +this.endCapHidden = (this.endcaps == 1); +}, "~B,~B"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/G3DRenderer.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/G3DRenderer.js new file mode 100755 index 000000000000..c8546bbe89d3 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/G3DRenderer.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.g3d"); +Clazz.declareInterface(J.g3d, "G3DRenderer"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/Graphics3D.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/Graphics3D.js new file mode 100755 index 000000000000..7cabe4ec7719 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/Graphics3D.js @@ -0,0 +1,1205 @@ +Clazz.declarePackage("J.g3d"); +Clazz.load(["J.api.JmolRendererInterface", "JU.GData", "JU.P3i", "$.V3"], "J.g3d.Graphics3D", ["java.util.Arrays", "JU.AU", "J.api.Interface", "J.c.STER", "J.g3d.CylinderRenderer", "$.LineRenderer", "$.Pixelator", "$.PixelatorScreened", "$.PixelatorShaded", "$.PixelatorT", "$.Platform3D", "$.SphereRenderer", "$.TextRenderer", "$.TextString", "JU.C", "$.Normix"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.platform = null; +this.line3d = null; +this.sphere3d = null; +this.cylinder3d = null; +this.triangle3d = null; +this.circle3d = null; +this.hermite3d = null; +this.isFullSceneAntialiasingEnabled = false; +this.antialias2 = false; +this.strings = null; +this.stringCount = 0; +this.anaglyphChannelBytes = null; +this.twoPass = false; +this.$haveTranslucentObjects = false; +this.pbuf = null; +this.pbufT = null; +this.zbuf = null; +this.zbufT = null; +this.translucencyMask = 0; +this.renderLow = false; +this.shadesCurrent = null; +this.anaglyphLength = 0; +this.pixel = null; +this.pixel0 = null; +this.pixelT0 = null; +this.pixelScreened = null; +this.pixelShaded = null; +this.zMargin = 0; +this.aobuf = null; +this.currentShadeIndex = 0; +this.lastRawColor = 0; +this.translucencyLog = 0; +this.wasScreened = false; +this.saveAmbient = 0; +this.saveDiffuse = 0; +this.sA = null; +this.sB = null; +this.sC = null; +this.vectorAB = null; +this.vectorAC = null; +this.vectorNormal = null; +this.shadeIndexes = null; +this.shadeIndexes2Sided = null; +this.pass2Flag01 = 0; +Clazz.instantialize(this, arguments);}, J.g3d, "Graphics3D", JU.GData, J.api.JmolRendererInterface); +Clazz.prepareFields (c$, function(){ +this.sA = new JU.P3i(); +this.sB = new JU.P3i(); +this.sC = new JU.P3i(); +this.vectorAB = new JU.V3(); +this.vectorAC = new JU.V3(); +this.vectorNormal = new JU.V3(); +this.shadeIndexes = Clazz.newByteArray (JU.GData.normixCount, 0); +this.shadeIndexes2Sided = Clazz.newByteArray (JU.GData.normixCount, 0); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.g3d.Graphics3D, []); +for (var i = JU.GData.normixCount; --i >= 0; ) this.transformedVectors[i] = new JU.V3(); + +}); +Clazz.overrideMethod(c$, "isWebGL", +function(){ +return false; +}); +Clazz.overrideMethod(c$, "clear", +function(){ +this.stringCount = 0; +this.strings = null; +J.g3d.TextRenderer.clearFontCache(); +}); +Clazz.overrideMethod(c$, "destroy", +function(){ +this.releaseBuffers(); +this.platform = null; +this.pixel = this.pixel0 = this.pixelShaded = null; +this.pixelT0 = null; +this.pixelScreened = null; +this.graphicsForMetrics = null; +}); +Clazz.defineMethod(c$, "setZMargin", +function(dz){ +this.zMargin = dz; +}, "~N"); +Clazz.overrideMethod(c$, "initialize", +function(vwr, apiPlatform){ +this.vwr = vwr; +this.apiPlatform = apiPlatform; +this.platform = new J.g3d.Platform3D(apiPlatform); +this.pixel = this.pixel0 = new J.g3d.Pixelator(this); +this.graphicsForMetrics = this.platform.getGraphicsForMetrics(); +this.line3d = new J.g3d.LineRenderer(this); +this.sphere3d = new J.g3d.SphereRenderer(this); +this.cylinder3d = new J.g3d.CylinderRenderer(this); +}, "JV.Viewer,J.api.GenericPlatform"); +Clazz.overrideMethod(c$, "addRenderer", +function(tok){ +switch (tok) { +case 1073741880: +if (this.circle3d == null) this.circle3d = this.getRenderer("Circle"); +break; +case 553648143: +if (this.hermite3d == null) this.hermite3d = this.getRenderer("Hermite"); +case 1073742182: +if (this.triangle3d == null) { +this.triangle3d = this.getRenderer("Triangle"); +(this.triangle3d).isOrthographic = !this.vwr.tm.perspectiveDepth; +}break; +} +}, "~N"); +Clazz.defineMethod(c$, "getRenderer", +function(type){ +var r = (J.api.Interface.getOption("g3d." + type + "Renderer", this.vwr, "render")); +if (r == null) throw new NullPointerException("Interface"); +r.set(this, this); +return r; +}, "~S"); +Clazz.overrideMethod(c$, "setWindowParameters", +function(width, height, antialias){ +this.setWinParams(width, height, antialias); +if (this.currentlyRendering) this.endRendering(); +}, "~N,~N,~B"); +Clazz.overrideMethod(c$, "checkTranslucent", +function(isAlphaTranslucent){ +if (isAlphaTranslucent) this.$haveTranslucentObjects = true; +return (!this.twoPass || this.twoPass && (this.isPass2 == isAlphaTranslucent)); +}, "~B"); +Clazz.overrideMethod(c$, "beginRendering", +function(rotationMatrix, translucentMode, isImageWrite, renderLow){ +if (this.currentlyRendering) this.endRendering(); +this.renderLow = renderLow; +if (this.windowWidth != this.newWindowWidth || this.windowHeight != this.newWindowHeight || this.newAntialiasing != this.isFullSceneAntialiasingEnabled) { +this.windowWidth = this.newWindowWidth; +this.windowHeight = this.newWindowHeight; +this.isFullSceneAntialiasingEnabled = this.newAntialiasing; +this.releaseBuffers(); +}this.setRotationMatrix(rotationMatrix); +(this.line3d).isOrthographic = !this.vwr.tm.perspectiveDepth; +if (this.triangle3d != null) (this.triangle3d).isOrthographic = !this.vwr.tm.perspectiveDepth; +this.antialiasEnabled = this.antialiasThisFrame = this.newAntialiasing; +this.currentlyRendering = true; +if (this.strings != null) for (var i = Math.min(this.strings.length, this.stringCount); --i >= 0; ) this.strings[i] = null; + +this.stringCount = 0; +this.twoPass = true; +this.isPass2 = false; +this.pass2Flag01 = 0; +this.colixCurrent = 0; +this.$haveTranslucentObjects = this.wasScreened = false; +this.pixel = this.pixel0; +this.pixel.bgcolor = this.bgcolor; +this.contrastColix = JU.C.getBgContrast(this.bgcolor); +this.translucentCoverOnly = !translucentMode; +if (this.pbuf == null) { +this.platform.allocateBuffers(this.windowWidth, this.windowHeight, this.antialiasThisFrame, isImageWrite); +this.pbuf = this.platform.pBuffer; +this.zbuf = this.platform.zBuffer; +this.aobuf = null; +this.pixel0.setBuf(); +if (this.pixelT0 != null) this.pixelT0.setBuf(); +if (this.pixelShaded != null) this.pixelShaded.setBuf(); +}this.setWidthHeight(this.antialiasThisFrame); +if (this.pixelScreened != null) this.pixelScreened.width = this.width; +this.platform.clearBuffer(); +if (this.backgroundImage != null) this.plotImage(-2147483648, 0, -2147483648, this.backgroundImage, null, 0, 0, 0); +this.textY = 0; +}, "JU.M3,~B,~B,~B"); +Clazz.overrideMethod(c$, "setBackgroundTransparent", +function(TF){ +if (this.platform != null) this.platform.setBackgroundTransparent(TF); +}, "~B"); +Clazz.defineMethod(c$, "releaseBuffers", +function(){ +this.pbuf = null; +this.zbuf = null; +this.pbufT = null; +this.zbufT = null; +this.aobuf = null; +this.platform.releaseBuffers(); +this.line3d.clearLineCache(); +}); +Clazz.overrideMethod(c$, "setPass2", +function(antialiasTranslucent){ +if (!this.$haveTranslucentObjects || !this.currentlyRendering) return false; +this.isPass2 = true; +this.pass2Flag01 = 1; +this.colixCurrent = 0; +if (this.pbufT == null || this.antialias2 != antialiasTranslucent) { +this.platform.allocateTBuffers(antialiasTranslucent); +this.pbufT = this.platform.pBufferT; +this.zbufT = this.platform.zBufferT; +}this.antialias2 = antialiasTranslucent; +if (this.antialiasThisFrame && !this.antialias2) this.downsampleFullSceneAntialiasing(true); +this.platform.clearTBuffer(); +if (this.pixelT0 == null) this.pixelT0 = new J.g3d.PixelatorT(this); +if (this.pixel.p0 == null) this.pixel = this.pixelT0; + else this.pixel.p0 = this.pixelT0; +return true; +}, "~B"); +Clazz.overrideMethod(c$, "endRendering", +function(){ +if (!this.currentlyRendering) return; +if (this.pbuf != null) { +if (this.isPass2 && this.pbufT != null) for (var offset = this.pbufT.length; --offset >= 0; ) this.pbuf[offset] = J.g3d.Graphics3D.mergeBufferPixel(this.pbuf[offset], this.pbufT[offset], this.bgcolor); + +if (this.pixel === this.pixelShaded && this.pixelShaded.zShadePower == 0) this.pixelShaded.showZBuffer(); +if (this.antialiasThisFrame) this.downsampleFullSceneAntialiasing(false); +}this.platform.setBackgroundColor(this.bgcolor); +this.platform.notifyEndOfRendering(); +this.currentlyRendering = this.isPass2 = false; +}); +c$.mergeBufferPixel = Clazz.defineMethod(c$, "mergeBufferPixel", +function(argbA, argbB, bgcolor){ +if (argbB == 0 || argbA == argbB) return argbA; +if (argbA == 0) argbA = bgcolor; +var rbA = (argbA & 0x00FF00FF); +var gA = (argbA & 0x0000FF00); +var rbB = (argbB & 0x00FF00FF); +var gB = (argbB & 0x0000FF00); +var logAlpha = (argbB >> 24) & 0xF; +switch (logAlpha) { +case 0: +rbA = rbB; +gA = gB; +break; +case 1: +rbA = (((rbB << 2) + (rbB << 1) + rbB + rbA) >> 3) & 0x00FF00FF; +gA = (((gB << 2) + +(gB << 1) + gB + gA) >> 3) & 0x0000FF00; +break; +case 2: +rbA = (((rbB << 1) + rbB + rbA) >> 2) & 0x00FF00FF; +gA = (((gB << 1) + gB + gA) >> 2) & 0x0000FF00; +break; +case 3: +rbA = (((rbB << 2) + rbB + (rbA << 1) + rbA) >> 3) & 0x00FF00FF; +gA = (((gB << 2) + gB + (gA << 1) + gA) >> 3) & 0x0000FF00; +break; +case 4: +rbA = ((rbA + rbB) >> 1) & 0x00FF00FF; +gA = ((gA + gB) >> 1) & 0x0000FF00; +break; +case 5: +rbA = (((rbB << 1) + rbB + (rbA << 2) + rbA) >> 3) & 0x00FF00FF; +gA = (((gB << 1) + gB + (gA << 2) + gA) >> 3) & 0x0000FF00; +break; +case 6: +rbA = (((rbA << 1) + rbA + rbB) >> 2) & 0x00FF00FF; +gA = (((gA << 1) + gA + gB) >> 2) & 0x0000FF00; +break; +case 7: +rbA = (((rbA << 2) + (rbA << 1) + rbA + rbB) >> 3) & 0x00FF00FF; +gA = (((gA << 2) + (gA << 1) + gA + gB) >> 3) & 0x0000FF00; +break; +} +return 0xFF000000 | rbA | gA; +}, "~N,~N,~N"); +Clazz.overrideMethod(c$, "getScreenImage", +function(isImageWrite){ +{ +var obj = this.platform.bufferedImage; if (isImageWrite) { +this.releaseBuffers(); } return obj; +}}, "~B"); +Clazz.overrideMethod(c$, "applyAnaglygh", +function(stereoMode, stereoColors){ +switch (stereoMode) { +case J.c.STER.REDCYAN: +for (var i = this.anaglyphLength; --i >= 0; ) { +var blue = this.anaglyphChannelBytes[i] & 0x000000FF; +var cyan = (blue << 8) | blue; +this.pbuf[i] = this.pbuf[i] & 0xFFFF0000 | cyan; +} +break; +case J.c.STER.CUSTOM: +var color1 = stereoColors[0]; +var color2 = stereoColors[1] & 0x00FFFFFF; +for (var i = this.anaglyphLength; --i >= 0; ) { +var a = this.anaglyphChannelBytes[i] & 0x000000FF; +a = (a | ((a | (a << 8)) << 8)) & color2; +this.pbuf[i] = (this.pbuf[i] & color1) | a; +} +break; +case J.c.STER.REDBLUE: +for (var i = this.anaglyphLength; --i >= 0; ) { +var blue = this.anaglyphChannelBytes[i] & 0x000000FF; +this.pbuf[i] = (this.pbuf[i] & 0xFFFF0000) | blue; +} +break; +case J.c.STER.REDGREEN: +for (var i = this.anaglyphLength; --i >= 0; ) { +var green = (this.anaglyphChannelBytes[i] & 0x000000FF) << 8; +this.pbuf[i] = (this.pbuf[i] & 0xFFFF0000) | green; +} +break; +case J.c.STER.DTI: +case J.c.STER.DOUBLE: +case J.c.STER.NONE: +break; +} +}, "J.c.STER,~A"); +Clazz.overrideMethod(c$, "snapshotAnaglyphChannelBytes", +function(){ +if (this.currentlyRendering) throw new NullPointerException(); +this.anaglyphLength = this.windowWidth * this.windowHeight; +if (this.anaglyphChannelBytes == null || this.anaglyphChannelBytes.length != this.anaglyphLength) this.anaglyphChannelBytes = Clazz.newByteArray (this.anaglyphLength, 0); +for (var i = this.anaglyphLength; --i >= 0; ) this.anaglyphChannelBytes[i] = this.pbuf[i]; + +}); +Clazz.overrideMethod(c$, "releaseScreenImage", +function(){ +this.platform.clearScreenBufferThreaded(); +}); +Clazz.overrideMethod(c$, "haveTranslucentObjects", +function(){ +return this.$haveTranslucentObjects; +}); +Clazz.overrideMethod(c$, "setSlabAndZShade", +function(slabValue, depthValue, zSlab, zDepth, zShadePower){ +this.setSlab(slabValue); +this.setDepth(depthValue); +if (zSlab < zDepth) { +if (this.pixelShaded == null) this.pixelShaded = new J.g3d.PixelatorShaded(this); +this.pixel = this.pixelShaded.set(zSlab, zDepth, zShadePower); +} else { +this.pixel = this.pixel0; +}}, "~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "downsampleFullSceneAntialiasing", +function(downsampleZBuffer){ +var bgcheck = this.bgcolor; +if (downsampleZBuffer) bgcheck += ((bgcheck & 0xFF) == 0xFF ? -1 : 1); +J.g3d.Graphics3D.downsample2d(this.pbuf, this.windowWidth, this.windowHeight, bgcheck); +if (downsampleZBuffer) { +J.g3d.Graphics3D.downsample2dZ(this.pbuf, this.zbuf, this.windowWidth, this.windowHeight, bgcheck); +this.antialiasThisFrame = false; +this.setWidthHeight(false); +}}, "~B"); +c$.downsample2d = Clazz.defineMethod(c$, "downsample2d", +function(pbuf, width, height, bgcheck){ +var width4 = width << 1; +if (bgcheck != 0) { +bgcheck &= 0xFFFFFF; +for (var i = pbuf.length; --i >= 0; ) if (pbuf[i] == 0) pbuf[i] = bgcheck; + +}var bg0 = ((bgcheck >> 2) & 0x3F3F3F3F) << 2; +bg0 += (bg0 & 0xC0C0C0C0) >> 6; +var offset1 = 0; +var offset4 = 0; +for (var i = height; --i >= 0; offset4 += width4) for (var j = width; --j >= 0; ++offset1) { +var argb = ((pbuf[offset4] >> 2) & 0x3F3F3F3F) + ((pbuf[offset4++ + width4] >> 2) & 0x3F3F3F3F) + ((pbuf[offset4] >> 2) & 0x3F3F3F3F) + ((pbuf[offset4++ + width4] >> 2) & 0x3F3F3F3F); +argb += (argb & 0xC0C0C0C0) >> 6; +if (argb == bg0) argb = bgcheck; +{ +pbuf[offset1] = argb & 0x00FFFFFF | 0xFF000000; +}} + +}, "~A,~N,~N,~N"); +c$.downsample2dZ = Clazz.defineMethod(c$, "downsample2dZ", +function(pbuf, zbuf, width, height, bgcheck){ +var width4 = width << 1; +var offset1 = 0; +var offset4 = 0; +for (var i = height; --i >= 0; offset4 += width4) for (var j = width; --j >= 0; ++offset1, ++offset4) { +var z = Math.min(zbuf[offset4], zbuf[offset4 + width4]); +z = Math.min(z, zbuf[++offset4]); +z = Math.min(z, zbuf[offset4 + width4]); +if (z != 2147483647) z >>= 1; +zbuf[offset1] = (pbuf[offset1] == bgcheck ? 2147483647 : z); +} + +}, "~A,~A,~N,~N,~N"); +Clazz.defineMethod(c$, "hasContent", +function(){ +return this.platform.hasContent(); +}); +Clazz.overrideMethod(c$, "setC", +function(colix){ +var isLast = JU.C.isColixLastAvailable(colix); +if (!isLast && colix == this.colixCurrent && this.currentShadeIndex == -1) return true; +var mask = colix & 30720; +if (mask == 16384) return false; +if (this.renderLow) mask = 0; +var isTranslucent = (mask != 0); +var isScreened = (isTranslucent && mask == 30720); +this.setScreened(isScreened); +if (!this.checkTranslucent(isTranslucent && !isScreened)) return false; +if (this.isPass2) { +this.translucencyMask = (mask << 13) | 0xFFFFFF; +this.translucencyLog = mask >> 11; +} else { +this.translucencyLog = 0; +}this.colixCurrent = colix; +if (isLast) { +if (this.argbCurrent != this.lastRawColor) { +if (this.argbCurrent == 0) this.argbCurrent = 0xFFFFFFFF; +this.lastRawColor = this.argbCurrent; +this.shader.setLastColix(this.argbCurrent, this.inGreyscaleMode); +}}this.shadesCurrent = this.getShades(colix); +this.currentShadeIndex = -1; +this.setColor(this.getColorArgbOrGray(colix)); +return true; +}, "~N"); +Clazz.defineMethod(c$, "setScreened", +function(isScreened){ +if (this.wasScreened != isScreened) { +this.wasScreened = isScreened; +if (isScreened) { +if (this.pixelScreened == null) this.pixelScreened = new J.g3d.PixelatorScreened(this, this.pixel0); +if (this.pixel.p0 == null) this.pixel = this.pixelScreened; + else this.pixel.p0 = this.pixelScreened; +} else if (this.pixel.p0 == null || this.pixel === this.pixelScreened) { +this.pixel = (this.isPass2 ? this.pixelT0 : this.pixel0); +} else { +this.pixel.p0 = (this.isPass2 ? this.pixelT0 : this.pixel0); +}}return this.pixel; +}, "~B"); +Clazz.overrideMethod(c$, "drawFilledCircle", +function(colixRing, colixFill, diameter, x, y, z){ +if (this.isClippedZ(z)) return; +var r = Clazz.doubleToInt((diameter + 1) / 2); +var isClipped = x < r || x + r >= this.width || y < r || y + r >= this.height; +if (isClipped && this.isClippedXY(diameter, x, y)) return; +if (colixRing != 0 && this.setC(colixRing)) { +if (isClipped) { +if (!this.isClippedXY(diameter, x, y)) (this.circle3d).plotCircleCenteredClipped(x, y, z, diameter); +} else { +(this.circle3d).plotCircleCenteredUnclipped(x, y, z, diameter); +}}if (colixFill != 0 && this.setC(colixFill)) { +if (isClipped) (this.circle3d).plotFilledCircleCenteredClipped(x, y, z, diameter); + else (this.circle3d).plotFilledCircleCenteredUnclipped(x, y, z, diameter); +}}, "~N,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "volumeRender4", +function(diameter, x, y, z){ +if (diameter == 1) { +this.plotPixelClippedArgb(this.argbCurrent, x, y, z, this.width, this.zbuf, this.pixel); +return; +}if (this.isClippedZ(z)) return; +var r = Clazz.doubleToInt((diameter + 1) / 2); +var isClipped = x < r || x + r >= this.width || y < r || y + r >= this.height; +if (isClipped && this.isClippedXY(diameter, x, y)) return; +if (isClipped) (this.circle3d).plotFilledCircleCenteredClipped(x, y, z, diameter); + else (this.circle3d).plotFilledCircleCenteredUnclipped(x, y, z, diameter); +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "fillSphereXYZ", +function(diameter, x, y, z){ +switch (diameter) { +case 1: +this.plotPixelClippedArgb(this.argbCurrent, x, y, z, this.width, this.zbuf, this.pixel); +return; +case 0: +return; +} +if (diameter <= (this.antialiasThisFrame ? 2000 : 1000)) this.sphere3d.render(this.shadesCurrent, diameter, x, y, z, null, null, null, -1, null); +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "volumeRender", +function(TF){ +if (TF) { +this.saveAmbient = this.getAmbientPercent(); +this.saveDiffuse = this.getDiffusePercent(); +this.setAmbientPercent(100); +this.setDiffusePercent(0); +this.addRenderer(1073741880); +} else { +this.setAmbientPercent(this.saveAmbient); +this.setDiffusePercent(this.saveDiffuse); +}}, "~B"); +Clazz.overrideMethod(c$, "fillSphereI", +function(diameter, center){ +this.fillSphereXYZ(diameter, center.x, center.y, center.z); +}, "~N,JU.P3i"); +Clazz.overrideMethod(c$, "fillSphereBits", +function(diameter, center){ +this.fillSphereXYZ(diameter, Math.round(center.x), Math.round(center.y), Math.round(center.z)); +}, "~N,JU.P3"); +Clazz.overrideMethod(c$, "fillEllipsoid", +function(center, points, x, y, z, diameter, mToEllipsoidal, coef, mDeriv, selectedOctant, octantPoints){ +switch (diameter) { +case 1: +this.plotPixelClippedArgb(this.argbCurrent, x, y, z, this.width, this.zbuf, this.pixel); +return; +case 0: +return; +} +if (diameter <= (this.antialiasThisFrame ? 2000 : 1000)) this.sphere3d.render(this.shadesCurrent, diameter, x, y, z, mToEllipsoidal, coef, mDeriv, selectedOctant, octantPoints); +}, "JU.P3,~A,~N,~N,~N,~N,JU.M3,~A,JU.M4,~N,~A"); +Clazz.overrideMethod(c$, "drawRect", +function(x, y, z, zSlab, rWidth, rHeight){ +if (zSlab != 0 && this.isClippedZ(zSlab)) return; +var w = rWidth - 1; +var h = rHeight - 1; +var xRight = x + w; +var yBottom = y + h; +if (y >= 0 && y < this.height) this.drawHLine(x, y, z, w); +if (yBottom >= 0 && yBottom < this.height) this.drawHLine(x, yBottom, z, w); +if (x >= 0 && x < this.width) this.drawVLine(x, y, z, h); +if (xRight >= 0 && xRight < this.width) this.drawVLine(xRight, y, z, h); +}, "~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "drawHLine", +function(x, y, z, w){ +if (w < 0) { +x += w; +w = -w; +}if (x < 0) { +w += x; +x = 0; +}if (x + w >= this.width) w = this.width - 1 - x; +var p = this.pixel; +var c = this.argbCurrent; +var offset = x + this.width * y; +for (var i = 0; i <= w; i++) { +if (z < this.zbuf[offset]) p.addPixel(offset, z, c); +offset++; +} +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "drawVLine", +function(x, y, z, h){ +if (h < 0) { +y += h; +h = -h; +}if (y < 0) { +h += y; +y = 0; +}if (y + h >= this.height) { +h = this.height - 1 - y; +}var offset = x + this.width * y; +var p = this.pixel; +var c = this.argbCurrent; +for (var i = 0; i <= h; i++) { +if (z < this.zbuf[offset]) p.addPixel(offset, z, c); +offset += this.width; +} +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "fillTextRect", +function(x, y, z, zSlab, widthFill, heightFill){ +if (this.isClippedZ(zSlab)) return; +var w = this.width; +if (x < 0) { +widthFill += x; +if (widthFill <= 0) return; +x = 0; +}if (x + widthFill > w) { +widthFill = w - x; +if (widthFill <= 0) return; +}if (y < 0) { +heightFill += y; +if (heightFill <= 0) return; +y = 0; +}if (y + heightFill > this.height) heightFill = this.height - y; +var c = this.argbCurrent; +if (this.isAntialiased()) c = J.g3d.Graphics3D.fixTextImageRGB(c); +var zb = this.zbuf; +var p = this.pixel; +while (--heightFill >= 0) this.plotPixelsUnclippedCount(c, widthFill, x, y++, z, w, zb, p); + +}, "~N,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawString", +function(str, font3d, xBaseline, yBaseline, z, zSlab, bgColix){ +this.currentShadeIndex = 0; +if (str == null) return; +if (this.isClippedZ(zSlab)) return; +this.drawStringNoSlab(str, font3d, xBaseline, yBaseline, z, bgColix); +}, "~S,JU.Font,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawStringNoSlab", +function(str, font3d, xBaseline, yBaseline, z, bgColix){ +if (str == null) return; +if (this.strings == null) this.strings = new Array(10); +if (this.stringCount == this.strings.length) this.strings = JU.AU.doubleLength(this.strings); +var t = new J.g3d.TextString(); +t.setText(str, font3d == null ? this.currentFont : (this.currentFont = font3d), this.argbCurrent, JU.C.isColixTranslucent(bgColix) ? (this.getColorArgbOrGray(bgColix) & 0xFFFFFF) | ((bgColix & 30720) << 13) : 0, xBaseline, yBaseline, z); +this.strings[this.stringCount++] = t; +}, "~S,JU.Font,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "renderAllStrings", +function(jmolRenderer){ +if (this.strings == null) return; +if (this.stringCount >= 2) { +if (J.g3d.Graphics3D.sort == null) J.g3d.Graphics3D.sort = new J.g3d.TextString(); +java.util.Arrays.sort(this.strings, J.g3d.Graphics3D.sort); +}for (var i = 0; i < this.stringCount; i++) { +var ts = this.strings[i]; +this.plotText(ts.x, ts.y, ts.z, ts.argb, ts.bgargb, ts.text, ts.font, jmolRenderer); +} +this.strings = null; +this.stringCount = 0; +}, "~O"); +Clazz.overrideMethod(c$, "plotText", +function(x, y, z, argb, bgargb, text, font3d, jmolRenderer){ +J.g3d.TextRenderer.plot(x, y, z, argb, bgargb, text, font3d, this, jmolRenderer, this.antialiasThisFrame); +}, "~N,~N,~N,~N,~N,~S,JU.Font,J.api.JmolRendererInterface"); +Clazz.overrideMethod(c$, "drawImage", +function(objImage, x, y, z, zSlab, bgcolix, width, height){ +if (objImage != null && width > 0 && height > 0 && !this.isClippedZ(zSlab)) this.plotImage(x, y, z, objImage, null, bgcolix, width, height); +}, "~O,~N,~N,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "plotImage", +function(x, y, z, image, jmolRenderer, bgcolix, imageWidth, imageHeight){ +this.setC(bgcolix); +if (!this.isPass2) this.translucencyMask = -1; +if (bgcolix == 0) this.argbCurrent = 0; +var isBackground = (x == -2147483648); +var bg = (isBackground ? this.bgcolor : this.argbCurrent); +if (isBackground) { +x = 0; +z = 2147483646; +imageWidth = this.width; +imageHeight = this.height; +}if (x + imageWidth <= 0 || x >= this.width || y + imageHeight <= 0 || y >= this.height) return; +var g; +{ +g = null; +}var buffer = this.apiPlatform.drawImageToBuffer(g, this.platform.offscreenImage, image, imageWidth, imageHeight, isBackground ? bg : 0); +if (buffer == null) return; +var zb = this.zbuf; +var w = this.width; +var p = this.pixel; +var h = this.height; +var t = this.translucencyLog; +if (jmolRenderer == null && (x >= 0 && x + imageWidth <= w && y >= 0 && y + imageHeight <= h)) { +for (var i = 0, offset = 0, pbufOffset = y * w + x; i < imageHeight; i++, pbufOffset += (w - imageWidth)) { +for (var j = 0; j < imageWidth; j++, offset++, pbufOffset++) { +if (z < zb[pbufOffset]) { +var b = buffer[offset]; +if ((b & 0xFF000000) == (-16777216)) p.addPixel(pbufOffset, z, b); +}} +} +} else { +if (jmolRenderer == null) jmolRenderer = this; +for (var i = 0, offset = 0; i < imageHeight; i++) for (var j = 0; j < imageWidth; j++) { +var b = buffer[offset++]; +if ((b & 0xFF000000) == (-16777216)) jmolRenderer.plotImagePixel(b, x + j, y + i, z, 8, bg, w, h, zb, p, t); +} + +}}, "~N,~N,~N,~O,J.api.JmolRendererInterface,~N,~N,~N"); +Clazz.overrideMethod(c$, "setFont", +function(font3d){ +this.currentFont = font3d; +}, "JU.Font"); +Clazz.overrideMethod(c$, "drawPixel", +function(x, y, z){ +this.plotPixelClippedArgb(this.argbCurrent, x, y, z, this.width, this.zbuf, this.pixel); +}, "~N,~N,~N"); +Clazz.overrideMethod(c$, "drawPoints", +function(count, coordinates, scale){ +if (scale > 1) { +var s2 = scale * scale * 0.8; +for (var i = -scale; i < scale; i++) { +for (var j = -scale; j < scale; j++) { +if (i * i + j * j > s2) continue; +this.plotPoints(count, coordinates, i, j); +this.plotPoints(count, coordinates, i, j); +} +} +} else { +this.plotPoints(count, coordinates, 0, 0); +}}, "~N,~A,~N"); +Clazz.overrideMethod(c$, "drawDashedLineBits", +function(run, rise, pointA, pointB){ +if (this.isAntialiased()) { +run += run; +rise += rise; +}this.setScreeni(pointA, this.sA); +this.setScreeni(pointB, this.sB); +this.drawLineABBits(run, rise, true); +}, "~N,~N,JU.P3,JU.P3"); +Clazz.defineMethod(c$, "drawLineABBits", +function(run, rise, andClip){ +this.line3d.plotLineBits(this.argbCurrent, this.argbCurrent, this.sA, this.sB, run, rise, andClip); +if (Math.abs(this.sA.x - this.sB.x) < Math.abs(this.sA.y - this.sB.y)) { +this.sA.x += 1; +this.sB.x += 1; +this.line3d.plotLineBits(this.argbCurrent, this.argbCurrent, this.sA, this.sB, run, rise, andClip); +} else { +this.sA.y += 1; +this.sB.y += 1; +this.line3d.plotLineBits(this.argbCurrent, this.argbCurrent, this.sA, this.sB, run, rise, andClip); +}}, "~N,~N,~B"); +Clazz.defineMethod(c$, "setScreeni", +function(pt, p){ +p.x = Math.round(pt.x); +p.y = Math.round(pt.y); +p.z = Math.round(pt.z); +}, "JU.P3,JU.P3i"); +Clazz.overrideMethod(c$, "drawLineXYZ", +function(x1, y1, z1, x2, y2, z2){ +this.line3d.plotLineOld(this.argbCurrent, this.argbCurrent, x1, y1, z1, x2, y2, z2); +}, "~N,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawLine", +function(colixA, colixB, x1, y1, z1, x2, y2, z2){ +if (!this.setC(colixA)) colixA = 0; +var argbA = this.argbCurrent; +if (!this.setC(colixB)) colixB = 0; +if (colixA != 0 || colixB != 0) this.line3d.plotLineOld(argbA, this.argbCurrent, x1, y1, z1, x2, y2, z2); +}, "~N,~N,~N,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawLineBits", +function(colixA, colixB, pointA, pointB){ +if (!this.setC(colixA)) colixA = 0; +var argbA = this.argbCurrent; +if (!this.setC(colixB)) colixB = 0; +if (colixA != 0 || colixB != 0) { +this.setScreeni(pointA, this.sA); +this.setScreeni(pointB, this.sB); +this.line3d.plotLineBits(argbA, this.argbCurrent, this.sA, this.sB, 0, 0, false); +}}, "~N,~N,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "drawLinePixels", +function(a, b, z, zslab){ +this.sA.setT(a); +this.sB.setT(b); +this.sA.z = this.sB.z = z; +var slab0 = this.slab; +if (zslab == -2147483648) this.slab = 0; +this.drawLineABBits(0, 0, false); +this.slab = slab0; +}, "JU.P3i,JU.P3i,~N,~N"); +Clazz.overrideMethod(c$, "drawLineAB", +function(pointA, pointB){ +this.setScreeni(pointA, this.sA); +this.setScreeni(pointB, this.sB); +this.line3d.plotLineBits(this.argbCurrent, this.argbCurrent, this.sA, this.sB, 0, 0, false); +}, "JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "fillCylinderXYZ", +function(colixA, colixB, endcaps, diameter, xA, yA, zA, xB, yB, zB){ +if (diameter > this.ht3) return; +var screen = 0; +this.currentShadeIndex = 0; +if (!this.setC(colixB)) colixB = 0; +if (this.wasScreened) screen = 2; +if (!this.setC(colixA)) colixA = 0; +if (this.wasScreened) screen += 1; +if (colixA == 0 && colixB == 0) return; +this.cylinder3d.renderOld(colixA, colixB, screen, endcaps, diameter, xA, yA, zA, xB, yB, zB); +}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "fillCylinderScreen3I", +function(endcaps, diameter, screenA, screenB, pt0f, pt1f, radius){ +if (diameter <= this.ht3) this.cylinder3d.renderOld(this.colixCurrent, this.colixCurrent, 0, endcaps, diameter, Clazz.floatToInt(screenA.x), Clazz.floatToInt(screenA.y), Clazz.floatToInt(screenA.z), Clazz.floatToInt(screenB.x), Clazz.floatToInt(screenB.y), Clazz.floatToInt(screenB.z)); +}, "~N,~N,JU.P3,JU.P3,JU.P3,JU.P3,~N"); +Clazz.overrideMethod(c$, "fillCylinder", +function(endcaps, diameter, screenA, screenB){ +if (diameter <= this.ht3) this.cylinder3d.renderOld(this.colixCurrent, this.colixCurrent, 0, endcaps, diameter, screenA.x, screenA.y, screenA.z, screenB.x, screenB.y, screenB.z); +}, "~N,~N,JU.P3i,JU.P3i"); +Clazz.overrideMethod(c$, "fillCylinderBits", +function(endcaps, diameter, screenA, screenB){ +if (diameter <= this.ht3 && screenA.z != 1 && screenB.z != 1) { +if (diameter == 0 || diameter == 1) { +this.setScreeni(screenA, this.sA); +this.setScreeni(screenB, this.sB); +this.line3d.plotLineBits(this.getColorArgbOrGray(this.colixCurrent), this.getColorArgbOrGray(this.colixCurrent), this.sA, this.sB, 0, 0, false); +return; +}this.cylinder3d.renderBitsFloat(this.colixCurrent, this.colixCurrent, 0, endcaps, diameter, screenA, screenB); +}}, "~N,~N,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "fillCylinderBits2", +function(colixA, colixB, endcaps, diameter, screenA, screenB){ +if (diameter > this.ht3) return; +var screen = 0; +this.currentShadeIndex = 0; +if (!this.setC(colixB)) colixB = 0; +if (this.wasScreened) screen = 2; +if (!this.setC(colixA)) colixA = 0; +if (this.wasScreened) screen += 1; +if (colixA == 0 && colixB == 0) return; +this.setScreeni(screenA, this.sA); +this.setScreeni(screenB, this.sB); +this.cylinder3d.renderBits(colixA, colixB, screen, endcaps, diameter, this.sA, this.sB); +}, "~N,~N,~N,~N,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "fillConeScreen3f", +function(endcap, screenDiameter, screenBase, screenTip, isBarb){ +if (screenDiameter <= this.ht3) this.cylinder3d.renderConeOld(this.colixCurrent, endcap, screenDiameter, screenBase.x, screenBase.y, screenBase.z, screenTip.x, screenTip.y, screenTip.z, true, isBarb); +}, "~N,~N,JU.P3,JU.P3,~B"); +Clazz.overrideMethod(c$, "drawHermite4", +function(tension, s0, s1, s2, s3){ +(this.hermite3d).renderHermiteRope(false, tension, 0, 0, 0, s0, s1, s2, s3); +}, "~N,JU.P3,JU.P3,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "drawHermite7", +function(fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, colixBack){ +if (colixBack == 0) { +(this.hermite3d).renderHermiteRibbon(fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, 0); +return; +}(this.hermite3d).renderHermiteRibbon(fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, 1); +var colix = this.colixCurrent; +this.setC(colixBack); +(this.hermite3d).renderHermiteRibbon(fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, -1); +this.setC(colix); +}, "~B,~B,~N,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,~N,~N"); +Clazz.overrideMethod(c$, "fillHermite", +function(tension, diameterBeg, diameterMid, diameterEnd, s0, s1, s2, s3){ +(this.hermite3d).renderHermiteRope(true, tension, diameterBeg, diameterMid, diameterEnd, s0, s1, s2, s3); +}, "~N,~N,~N,~N,JU.P3,JU.P3,JU.P3,JU.P3"); +Clazz.overrideMethod(c$, "drawTriangle3C", +function(screenA, colixA, screenB, colixB, screenC, colixC, check){ +if ((check & 1) == 1) this.drawLine(colixA, colixB, screenA.x, screenA.y, screenA.z, screenB.x, screenB.y, screenB.z); +if ((check & 2) == 2) this.drawLine(colixB, colixC, screenB.x, screenB.y, screenB.z, screenC.x, screenC.y, screenC.z); +if ((check & 4) == 4) this.drawLine(colixA, colixC, screenA.x, screenA.y, screenA.z, screenC.x, screenC.y, screenC.z); +}, "JU.P3i,~N,JU.P3i,~N,JU.P3i,~N,~N"); +Clazz.overrideMethod(c$, "fillTriangleTwoSided", +function(normix, screenA, screenB, screenC){ +this.setColorNoisy(this.getShadeIndex(normix)); +this.fillTriangleP3f(screenA, screenB, screenC, false); +}, "~N,JU.P3,JU.P3,JU.P3"); +Clazz.defineMethod(c$, "fillTriangleP3f", +function(screenA, screenB, screenC, useGouraud){ +this.setScreeni(screenA, this.sA); +this.setScreeni(screenB, this.sB); +this.setScreeni(screenC, this.sC); +(this.triangle3d).fillTriangle(this.sA, this.sB, this.sC, useGouraud); +}, "JU.P3,JU.P3,JU.P3,~B"); +Clazz.overrideMethod(c$, "fillTriangle3f", +function(screenA, screenB, screenC, isSolid){ +var i = this.getShadeIndexP3(screenA, screenB, screenC, isSolid); +if (i < 0) return; +if (isSolid) this.setColorNoisy(i); + else this.setColor(this.shadesCurrent[i]); +this.fillTriangleP3f(screenA, screenB, screenC, false); +}, "JU.P3,JU.P3,JU.P3,~B"); +Clazz.overrideMethod(c$, "fillTriangle3i", +function(screenA, screenB, screenC, ptA, ptB, ptC, doShade){ +if (doShade) { +var v = this.vectorAB; +v.set(screenB.x - screenA.x, screenB.y - screenA.y, screenB.z - screenA.z); +var shadeIndex; +if (screenC == null) { +shadeIndex = this.shader.getShadeIndex(-v.x, -v.y, v.z); +} else { +this.vectorAC.set(screenC.x - screenA.x, screenC.y - screenA.y, screenC.z - screenA.z); +v.cross(v, this.vectorAC); +shadeIndex = v.z >= 0 ? this.shader.getShadeIndex(-v.x, -v.y, v.z) : this.shader.getShadeIndex(v.x, v.y, -v.z); +}if (shadeIndex > 56) shadeIndex = 56; +this.setColorNoisy(shadeIndex); +}this.fillTriangleP3f(screenA, screenB, screenC, false); +}, "JU.P3,JU.P3,JU.P3,JU.T3,JU.T3,JU.T3,~B"); +Clazz.overrideMethod(c$, "fillTriangle3CN", +function(screenA, colixA, normixA, screenB, colixB, normixB, screenC, colixC, normixC){ +(this.triangle3d).fillTriangle(screenA, screenB, screenC, this.checkGouraud(colixA, colixB, colixC, normixA, normixB, normixC)); +}, "JU.P3i,~N,~N,JU.P3i,~N,~N,JU.P3i,~N,~N"); +Clazz.overrideMethod(c$, "fillTriangle3CNBits", +function(screenA, colixA, normixA, screenB, colixB, normixB, screenC, colixC, normixC, twoSided){ +this.fillTriangleP3f(screenA, screenB, screenC, this.checkGouraud(colixA, colixB, colixC, normixA, normixB, normixC)); +}, "JU.P3,~N,~N,JU.P3,~N,~N,JU.P3,~N,~N,~B"); +Clazz.defineMethod(c$, "checkGouraud", +function(colixA, colixB, colixC, normixA, normixB, normixC){ +if (!this.isPass2 && normixA == normixB && normixA == normixC && colixA == colixB && colixA == colixC) { +var shadeIndex = this.getShadeIndex(normixA); +if (colixA != this.colixCurrent || this.currentShadeIndex != shadeIndex) { +this.currentShadeIndex = -1; +this.setC(colixA); +this.setColorNoisy(shadeIndex); +}return false; +}this.setTriangleTranslucency(colixA, colixB, colixC); +(this.triangle3d).setGouraud(this.getShades(colixA)[this.getShadeIndex(normixA)], this.getShades(colixB)[this.getShadeIndex(normixB)], this.getShades(colixC)[this.getShadeIndex(normixC)]); +return true; +}, "~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "getShadeIndex", +function(normix){ +return (normix == -10000 || normix == 9999 ? J.g3d.Graphics3D.nullShadeIndex : normix < 0 ? this.shadeIndexes2Sided[~normix] : this.shadeIndexes[normix]); +}, "~N"); +Clazz.defineMethod(c$, "setTriangleTranslucency", +function(colixA, colixB, colixC){ +if (this.isPass2) { +var maskA = colixA & 30720; +var maskB = colixB & 30720; +var maskC = colixC & 30720; +maskA &= -16385; +maskB &= -16385; +maskC &= -16385; +var mask = JU.GData.roundInt(Clazz.doubleToInt((maskA + maskB + maskC) / 3)) & 30720; +this.translucencyMask = (mask << 13) | 0xFFFFFF; +}}, "~N,~N,~N"); +Clazz.overrideMethod(c$, "fillQuadrilateral", +function(screenA, screenB, screenC, screenD, isSolid){ +var i = this.getShadeIndexP3(screenA, screenB, screenC, isSolid); +if (i < 0) return; +this.setColorNoisy(i); +this.fillTriangleP3f(screenA, screenB, screenC, false); +this.fillTriangleP3f(screenA, screenC, screenD, false); +}, "JU.P3,JU.P3,JU.P3,JU.P3,~B"); +Clazz.overrideMethod(c$, "drawSurface", +function(meshSurface, colix){ +}, "JU.MeshSurface,~N"); +Clazz.overrideMethod(c$, "plotPixelClippedP3i", +function(screen){ +this.plotPixelClippedArgb(this.argbCurrent, screen.x, screen.y, screen.z, this.width, this.zbuf, this.pixel); +}, "JU.P3i"); +Clazz.defineMethod(c$, "plotPixelClippedArgb", +function(argb, x, y, z, width, zbuf, p){ +if (this.isClipped3(x, y, z)) return; +var offset = y * width + x; +if (z < zbuf[offset]) p.addPixel(offset, z, argb); +}, "~N,~N,~N,~N,~N,~A,J.g3d.Pixelator"); +Clazz.defineMethod(c$, "plotPixelUnclipped", +function(argb, x, y, z, width, zbuf, p){ +var offset = y * width + x; +if (z < zbuf[offset]) p.addPixel(offset, z, argb); +}, "~N,~N,~N,~N,~N,~A,J.g3d.Pixelator"); +Clazz.defineMethod(c$, "plotImagePixel", +function(argb, x, y, z, shade, bgargb, width, height, zbuf, p, transpLog){ +if (x < 0 || x >= width || y < 0 || y >= height) return; +(p).addImagePixel(shade, transpLog, y * width + x, z, argb, bgargb); +}, "~N,~N,~N,~N,~N,~N,~N,~N,~A,~O,~N"); +Clazz.defineMethod(c$, "plotPixelsClippedRaster", +function(count, x, y, zAtLeft, zPastRight, rgb16Left, rgb16Right){ +var depth; +var slab; +if (count <= 0 || y < 0 || y >= this.height || x >= this.width || (zAtLeft < (slab = this.slab) && zPastRight < slab) || (zAtLeft > (depth = this.depth) && zPastRight > depth)) return; +var zb = this.zbuf; +var seed = (x << 16) + (y << 1) ^ 0x33333333; +var zScaled = (zAtLeft << 10) + (512); +var dz = zPastRight - zAtLeft; +var roundFactor = Clazz.doubleToInt(count / 2); +var zIncrementScaled = JU.GData.roundInt(Clazz.doubleToInt(((dz << 10) + (dz >= 0 ? roundFactor : -roundFactor)) / count)); +if (x < 0) { +x = -x; +zScaled += zIncrementScaled * x; +count -= x; +if (count <= 0) return; +x = 0; +}if (count + x > this.width) count = this.width - x; +var offsetPbuf = y * this.width + x; +var p = this.pixel; +if (rgb16Left == null) { +var adn = this.argbNoisyDn; +var aup = this.argbNoisyUp; +var ac = this.argbCurrent; +while (--count >= 0) { +var z = zScaled >> 10; +if (z >= slab && z <= depth && z < zb[offsetPbuf]) { +seed = ((seed << 16) + (seed << 1) + seed) & 0x7FFFFFFF; +var bits = (seed >> 16) & 0x07; +p.addPixel(offsetPbuf, z, bits == 0 ? adn : (bits == 1 ? aup : ac)); +}++offsetPbuf; +zScaled += zIncrementScaled; +} +} else { +var rScaled = rgb16Left.r << 8; +var rIncrement = Clazz.doubleToInt(((rgb16Right.r - rgb16Left.r) << 8) / count); +var gScaled = rgb16Left.g; +var gIncrement = Clazz.doubleToInt((rgb16Right.g - gScaled) / count); +var bScaled = rgb16Left.b; +var bIncrement = Clazz.doubleToInt((rgb16Right.b - bScaled) / count); +while (--count >= 0) { +var z = zScaled >> 10; +if (z >= slab && z <= depth && z < zb[offsetPbuf]) p.addPixel(offsetPbuf, z, 0xFF000000 | (rScaled & 0xFF0000) | (gScaled & 0xFF00) | ((bScaled >> 8) & 0xFF)); +++offsetPbuf; +zScaled += zIncrementScaled; +rScaled += rIncrement; +gScaled += gIncrement; +bScaled += bIncrement; +} +}}, "~N,~N,~N,~N,~N,JU.Rgb16,JU.Rgb16"); +Clazz.defineMethod(c$, "plotPixelsUnclippedRaster", +function(count, x, y, zAtLeft, zPastRight, rgb16Left, rgb16Right){ +if (count <= 0) return; +var seed = ((x << 16) + (y << 1) ^ 0x33333333) & 0x7FFFFFFF; +var zScaled = (zAtLeft << 10) + (512); +var dz = zPastRight - zAtLeft; +var roundFactor = Clazz.doubleToInt(count / 2); +var zIncrementScaled = JU.GData.roundInt(Clazz.doubleToInt(((dz << 10) + (dz >= 0 ? roundFactor : -roundFactor)) / count)); +var offsetPbuf = y * this.width + x; +var zb = this.zbuf; +var p = this.pixel; +if (rgb16Left == null) { +var adn = this.argbNoisyDn; +var aup = this.argbNoisyUp; +var ac = this.argbCurrent; +while (--count >= 0) { +var z = zScaled >> 10; +if (z < zb[offsetPbuf]) { +seed = ((seed << 16) + (seed << 1) + seed) & 0x7FFFFFFF; +var bits = (seed >> 16) & 0x07; +p.addPixel(offsetPbuf, z, bits == 0 ? adn : (bits == 1 ? aup : ac)); +}++offsetPbuf; +zScaled += zIncrementScaled; +} +} else { +var rScaled = rgb16Left.r << 8; +var rIncrement = JU.GData.roundInt(Clazz.doubleToInt(((rgb16Right.r - rgb16Left.r) << 8) / count)); +var gScaled = rgb16Left.g; +var gIncrement = JU.GData.roundInt(Clazz.doubleToInt((rgb16Right.g - gScaled) / count)); +var bScaled = rgb16Left.b; +var bIncrement = JU.GData.roundInt(Clazz.doubleToInt((rgb16Right.b - bScaled) / count)); +while (--count >= 0) { +var z = zScaled >> 10; +if (z < zb[offsetPbuf]) p.addPixel(offsetPbuf, z, 0xFF000000 | (rScaled & 0xFF0000) | (gScaled & 0xFF00) | ((bScaled >> 8) & 0xFF)); +++offsetPbuf; +zScaled += zIncrementScaled; +rScaled += rIncrement; +gScaled += gIncrement; +bScaled += bIncrement; +} +}}, "~N,~N,~N,~N,~N,JU.Rgb16,JU.Rgb16"); +Clazz.defineMethod(c$, "plotPixelsClippedRasterBits", +function(count, x, y, zAtLeft, zPastRight, rgb16Left, rgb16Right, a, b){ +var depth; +var slab; +if (count <= 0 || y < 0 || y >= this.height || x >= this.width || (zAtLeft < (slab = this.slab) && zPastRight < slab) || (zAtLeft > (depth = this.depth) && zPastRight > depth)) return; +var zb = this.zbuf; +var seed = (x << 16) + (y << 1) ^ 0x33333333; +if (x < 0) { +x = -x; +count -= x; +if (count <= 0) return; +x = 0; +}if (count + x > this.width) count = this.width - x; +var offsetPbuf = y * this.width + x; +var p = this.pixel; +if (rgb16Left == null) { +var adn = this.argbNoisyDn; +var aup = this.argbNoisyUp; +var ac = this.argbCurrent; +while (--count >= 0) { +var zCurrent = this.line3d.getZCurrent(a, b, x++); +if (zCurrent >= slab && zCurrent <= depth && zCurrent < zb[offsetPbuf]) { +seed = ((seed << 16) + (seed << 1) + seed) & 0x7FFFFFFF; +var bits = (seed >> 16) & 0x07; +p.addPixel(offsetPbuf, zCurrent, bits < 2 ? adn : bits < 6 ? aup : ac); +}++offsetPbuf; +} +} else { +var rScaled = rgb16Left.r << 8; +var rIncrement = Clazz.doubleToInt(((rgb16Right.r - rgb16Left.r) << 8) / count); +var gScaled = rgb16Left.g; +var gIncrement = Clazz.doubleToInt((rgb16Right.g - gScaled) / count); +var bScaled = rgb16Left.b; +var bIncrement = Clazz.doubleToInt((rgb16Right.b - bScaled) / count); +while (--count >= 0) { +var zCurrent = this.line3d.getZCurrent(a, b, x++); +if (zCurrent >= slab && zCurrent <= depth && zCurrent < zb[offsetPbuf]) p.addPixel(offsetPbuf, zCurrent, 0xFF000000 | (rScaled & 0xFF0000) | (gScaled & 0xFF00) | ((bScaled >> 8) & 0xFF)); +++offsetPbuf; +rScaled += rIncrement; +gScaled += gIncrement; +bScaled += bIncrement; +} +}}, "~N,~N,~N,~N,~N,JU.Rgb16,JU.Rgb16,~N,~N"); +Clazz.defineMethod(c$, "plotPixelsUnclippedRasterBits", +function(count, x, y, rgb16Left, rgb16Right, a, b){ +if (count <= 0) return; +var seed = ((x << 16) + (y << 1) ^ 0x33333333) & 0x7FFFFFFF; +var offsetPbuf = y * this.width + x; +var zb = this.zbuf; +var p = this.pixel; +if (rgb16Left == null) { +var adn = this.argbNoisyDn; +var aup = this.argbNoisyUp; +var ac = this.argbCurrent; +while (--count >= 0) { +var zCurrent = this.line3d.getZCurrent(a, b, x++); +if (zCurrent < zb[offsetPbuf]) { +seed = ((seed << 16) + (seed << 1) + seed) & 0x7FFFFFFF; +var bits = (seed >> 16) & 0x07; +var c = (bits == 0 ? adn : bits == 1 ? aup : ac); +p.addPixel(offsetPbuf, zCurrent, c); +}++offsetPbuf; +} +} else { +var rScaled = rgb16Left.r << 8; +var rIncrement = JU.GData.roundInt(Clazz.doubleToInt(((rgb16Right.r - rgb16Left.r) << 8) / count)); +var gScaled = rgb16Left.g; +var gIncrement = JU.GData.roundInt(Clazz.doubleToInt((rgb16Right.g - gScaled) / count)); +var bScaled = rgb16Left.b; +var bIncrement = JU.GData.roundInt(Clazz.doubleToInt((rgb16Right.b - bScaled) / count)); +while (--count >= 0) { +var zCurrent = this.line3d.getZCurrent(a, b, x++); +if (zCurrent < zb[offsetPbuf]) p.addPixel(offsetPbuf, zCurrent, 0xFF000000 | (rScaled & 0xFF0000) | (gScaled & 0xFF00) | ((bScaled >> 8) & 0xFF)); +++offsetPbuf; +rScaled += rIncrement; +gScaled += gIncrement; +bScaled += bIncrement; +} +}}, "~N,~N,~N,JU.Rgb16,JU.Rgb16,~N,~N"); +Clazz.defineMethod(c$, "plotPixelsUnclippedCount", +function(c, count, x, y, z, width, zbuf, p){ +var offsetPbuf = y * width + x; +while (--count >= 0) { +if (z < zbuf[offsetPbuf]) p.addPixel(offsetPbuf, z, c); +++offsetPbuf; +} +}, "~N,~N,~N,~N,~N,~N,~A,J.g3d.Pixelator"); +Clazz.defineMethod(c$, "plotPoints", +function(count, coordinates, xOffset, yOffset){ +var p = this.pixel; +var c = this.argbCurrent; +var zb = this.zbuf; +var w = this.width; +var antialias = this.antialiasThisFrame; +for (var i = count * 3; i > 0; ) { +var z = coordinates[--i]; +var y = coordinates[--i] + yOffset; +var x = coordinates[--i] + xOffset; +if (this.isClipped3(x, y, z)) continue; +var offset = y * w + x++; +if (z < zb[offset]) p.addPixel(offset, z, c); +if (antialias) { +offset = y * w + x; +if (!this.isClipped3(x, y, z) && z < zb[offset]) p.addPixel(offset, z, c); +offset = (++y) * w + x; +if (!this.isClipped3(x, y, z) && z < zb[offset]) p.addPixel(offset, z, c); +offset = y * w + (--x); +if (!this.isClipped3(x, y, z) && z < zb[offset]) p.addPixel(offset, z, c); +}} +}, "~N,~A,~N,~N"); +Clazz.defineMethod(c$, "setColorNoisy", +function(shadeIndex){ +this.currentShadeIndex = shadeIndex; +this.argbCurrent = this.shadesCurrent[shadeIndex]; +this.argbNoisyUp = this.shadesCurrent[shadeIndex < 63 ? shadeIndex + 1 : 63]; +this.argbNoisyDn = this.shadesCurrent[shadeIndex > 0 ? shadeIndex - 1 : 0]; +}, "~N"); +Clazz.defineMethod(c$, "getShadeIndexP3", +function(screenA, screenB, screenC, isSolid){ +this.vectorAB.sub2(screenB, screenA); +this.vectorAC.sub2(screenC, screenA); +var v = this.vectorNormal; +v.cross(this.vectorAB, this.vectorAC); +var i = (v.z < 0 ? this.shader.getShadeIndex(v.x, v.y, -v.z) : isSolid ? -1 : this.shader.getShadeIndex(-v.x, -v.y, v.z)); +return i; +}, "JU.P3,JU.P3,JU.P3,~B"); +Clazz.overrideMethod(c$, "renderBackground", +function(jmolRenderer){ +if (this.backgroundImage != null) this.plotImage(-2147483648, 0, -2147483648, this.backgroundImage, jmolRenderer, 0, 0, 0); +}, "J.api.JmolRendererInterface"); +Clazz.overrideMethod(c$, "drawAtom", +function(atom, radius){ +this.fillSphereXYZ(atom.sD, atom.sX, atom.sY, atom.sZ); +}, "JM.Atom,~N"); +Clazz.overrideMethod(c$, "getExportType", +function(){ +return 0; +}); +Clazz.overrideMethod(c$, "getExportName", +function(){ +return null; +}); +Clazz.defineMethod(c$, "canDoTriangles", +function(){ +return true; +}); +Clazz.defineMethod(c$, "isCartesianExport", +function(){ +return false; +}); +Clazz.overrideMethod(c$, "initializeExporter", +function(vwr, privateKey, g3d, params){ +return null; +}, "JV.Viewer,~N,JU.GData,java.util.Map"); +Clazz.overrideMethod(c$, "finalizeOutput", +function(){ +return null; +}); +Clazz.overrideMethod(c$, "drawBond", +function(atomA, atomB, colixA, colixB, endcaps, mad, bondOrder){ +}, "JU.P3,JU.P3,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "drawEllipse", +function(ptAtom, ptX, ptY, fillArc, wireframeOnly){ +return false; +}, "JU.P3,JU.P3,JU.P3,~B,~B"); +Clazz.defineMethod(c$, "getPrivateKey", +function(){ +return 0; +}); +Clazz.overrideMethod(c$, "clearFontCache", +function(){ +J.g3d.TextRenderer.clearFontCache(); +}); +Clazz.defineMethod(c$, "setRotationMatrix", +function(rotationMatrix){ +var vertexVectors = JU.Normix.getVertexVectors(); +for (var i = JU.GData.normixCount; --i >= 0; ) { +var tv = this.transformedVectors[i]; +rotationMatrix.rotate2(vertexVectors[i], tv); +this.shadeIndexes[i] = this.shader.getShadeB(tv.x, -tv.y, tv.z); +this.shadeIndexes2Sided[i] = (tv.z >= 0 ? this.shadeIndexes[i] : this.shader.getShadeB(-tv.x, tv.y, -tv.z)); +} +}, "JU.M3"); +Clazz.overrideMethod(c$, "renderCrossHairs", +function(minMax, screenWidth, screenHeight, navOffset, navDepth){ +var antialiased = this.isAntialiased(); +this.setC(navDepth < 0 ? 10 : navDepth > 100 ? 11 : 23); +var x = Math.max(Math.min(this.width, Math.round(navOffset.x)), 0); +var y = Math.max(Math.min(this.height, Math.round(navOffset.y)), 0); +var z = Math.round(navOffset.z) + 1; +var off = (antialiased ? 8 : 4); +var h = (antialiased ? 20 : 10); +var w = (antialiased ? 2 : 1); +this.drawRect(x - off, y, z, 0, h, w); +this.drawRect(x, y - off, z, 0, w, h); +this.drawRect(x - off, y - off, z, 0, h, h); +off = h; +h = h >> 1; +this.setC(minMax[1] < navOffset.x ? 21 : 11); +this.drawRect(x - off, y, z, 0, h, w); +this.setC(minMax[0] > navOffset.x ? 21 : 11); +this.drawRect(x + h, y, z, 0, h, w); +this.setC(minMax[3] < navOffset.y ? 21 : 11); +this.drawRect(x, y - off, z, 0, w, h); +this.setC(minMax[2] > navOffset.y ? 21 : 11); +this.drawRect(x, y + h, z, 0, w, h); +}, "~A,~N,~N,JU.P3,~N"); +Clazz.overrideMethod(c$, "initializeOutput", +function(vwr, privateKey, params){ +return false; +}, "JV.Viewer,~N,java.util.Map"); +c$.fixTextImageRGB = Clazz.defineMethod(c$, "fixTextImageRGB", +function(argb){ +return ((argb & 0xC0C0C0) == 0 ? argb | 0x040404 : argb); +}, "~N"); +c$.sort = null; +c$.nullShadeIndex = 50; +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/HermiteRenderer.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/HermiteRenderer.js new file mode 100755 index 000000000000..403f892671ac --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/HermiteRenderer.js @@ -0,0 +1,364 @@ +Clazz.declarePackage("J.g3d"); +Clazz.load(["J.g3d.G3DRenderer", "JU.P3", "$.V3"], "J.g3d.HermiteRenderer", ["JU.Lst", "$.P3i"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.g3d = null; +this.gdata = null; +this.pLeft = null; +this.pRight = null; +this.sLeft = null; +this.sRight = null; +this.pTopLeft = null; +this.pTopRight = null; +this.pBotLeft = null; +this.pBotRight = null; +this.a1 = null; +this.a2 = null; +this.b1 = null; +this.b2 = null; +this.c1 = null; +this.c2 = null; +this.d1 = null; +this.d2 = null; +this.T1 = null; +this.T2 = null; +this.depth1 = null; +this.needToFill = null; +Clazz.instantialize(this, arguments);}, J.g3d, "HermiteRenderer", null, J.g3d.G3DRenderer); +Clazz.prepareFields (c$, function(){ +this.pLeft = new Array(16); +this.pRight = new Array(16); +this.sLeft = Clazz.newFloatArray (16, 0); +this.sRight = Clazz.newFloatArray (16, 0); +this.pTopLeft = new Array(16); +this.pTopRight = new Array(16); +this.pBotLeft = new Array(16); +this.pBotRight = new Array(16); +{ +for (var i = 16; --i >= 0; ) { +this.pLeft[i] = new JU.P3i(); +this.pRight[i] = new JU.P3i(); +this.pTopLeft[i] = new JU.P3(); +this.pTopRight[i] = new JU.P3(); +this.pBotLeft[i] = new JU.P3(); +this.pBotRight[i] = new JU.P3(); +} +}this.a1 = new JU.P3(); +this.a2 = new JU.P3(); +this.b1 = new JU.P3(); +this.b2 = new JU.P3(); +this.c1 = new JU.P3(); +this.c2 = new JU.P3(); +this.d1 = new JU.P3(); +this.d2 = new JU.P3(); +this.T1 = new JU.V3(); +this.T2 = new JU.V3(); +this.depth1 = new JU.V3(); +this.needToFill = Clazz.newBooleanArray(16, false); +}); +Clazz.makeConstructor(c$, +function(){ +}); +Clazz.overrideMethod(c$, "set", +function(g3d, gdata){ +this.g3d = g3d; +this.gdata = gdata; +return this; +}, "J.api.JmolRendererInterface,JU.GData"); +Clazz.defineMethod(c$, "renderHermiteRope", +function(fill, tension, diameterBeg, diameterMid, diameterEnd, p0, p1, p2, p3){ +var z1 = Clazz.floatToInt(p1.z); +var z2 = Clazz.floatToInt(p2.z); +if (p0.z == 1 || z1 == 1 || z2 == 1 || p3.z == 1) return; +if (this.gdata.isClippedZ(z1) || this.gdata.isClippedZ(z2)) return; +var x1 = Clazz.floatToInt(p1.x); +var y1 = Clazz.floatToInt(p1.y); +var x2 = Clazz.floatToInt(p2.x); +var y2 = Clazz.floatToInt(p2.y); +var xT1 = Clazz.doubleToInt(((x2 - Clazz.floatToInt(p0.x)) * tension) / 8); +var yT1 = Clazz.doubleToInt(((y2 - Clazz.floatToInt(p0.y)) * tension) / 8); +var zT1 = Clazz.doubleToInt(((z2 - Clazz.floatToInt(p0.z)) * tension) / 8); +var xT2 = Clazz.doubleToInt(((Clazz.floatToInt(p3.x) - x1) * tension) / 8); +var yT2 = Clazz.doubleToInt(((Clazz.floatToInt(p3.y) - y1) * tension) / 8); +var zT2 = Clazz.doubleToInt(((Clazz.floatToInt(p3.z) - z1) * tension) / 8); +this.sLeft[0] = 0; +this.pLeft[0].set(x1, y1, z1); +this.sRight[0] = 1; +this.pRight[0].set(x2, y2, z2); +var sp = 0; +var dDiameterFirstHalf = 0; +var dDiameterSecondHalf = 0; +if (fill) { +dDiameterFirstHalf = 2 * (diameterMid - diameterBeg); +dDiameterSecondHalf = 2 * (diameterEnd - diameterMid); +}do { +var a = this.pLeft[sp]; +var b = this.pRight[sp]; +var dx = b.x - a.x; +if (dx >= -1 && dx <= 1) { +var dy = b.y - a.y; +if (dy >= -1 && dy <= 1) { +var s = this.sLeft[sp]; +if (fill) { +var d = (s < 0.5 ? diameterBeg + Clazz.floatToInt(dDiameterFirstHalf * s) : diameterMid + Clazz.floatToInt(dDiameterSecondHalf * (s - 0.5))); +this.g3d.fillSphereI(d, a); +} else { +this.g3d.plotPixelClippedP3i(a); +}--sp; +continue; +}}var s = (this.sLeft[sp] + this.sRight[sp]) / 2; +var s2 = s * s; +var s3 = s2 * s; +var h1 = 2 * s3 - 3 * s2 + 1; +var h2 = -2 * s3 + 3 * s2; +var h3 = s3 - 2 * s2 + s; +var h4 = s3 - s2; +if (sp >= 15) break; +var pMid = this.pRight[sp + 1]; +pMid.x = Clazz.doubleToInt(h1 * x1 + h2 * x2 + h3 * xT1 + h4 * xT2); +pMid.y = Clazz.doubleToInt(h1 * y1 + h2 * y2 + h3 * yT1 + h4 * yT2); +pMid.z = Clazz.doubleToInt(h1 * z1 + h2 * z2 + h3 * zT1 + h4 * zT2); +this.pRight[sp + 1] = this.pRight[sp]; +this.sRight[sp + 1] = this.sRight[sp]; +this.pRight[sp] = pMid; +this.sRight[sp] = s; +++sp; +this.pLeft[sp].setT(pMid); +this.sLeft[sp] = s; +} while (sp >= 0); +}, "~B,~N,~N,~N,~N,JU.P3,JU.P3,JU.P3,JU.P3"); +Clazz.defineMethod(c$, "renderHermiteRibbon", +function(fill, border, tension, p0, p1, p2, p3, p4, p5, p6, p7, aspectRatio, fillType){ +if (p0.z == 1 || p1.z == 1 || p2.z == 1 || p3.z == 1 || p4.z == 1 || p5.z == 1 || p6.z == 1 || p7.z == 1) return; +if (!fill) { +tension = Math.abs(tension); +this.renderParallelPair(fill, tension, p0, p1, p2, p3, p4, p5, p6, p7); +return; +}var isRev = (tension < 0); +if (isRev) tension = -tension; +var ratio = 1 / aspectRatio; +var x1 = Clazz.floatToInt(p1.x); +var y1 = Clazz.floatToInt(p1.y); +var z1 = Clazz.floatToInt(p1.z); +var x2 = Clazz.floatToInt(p2.x); +var y2 = Clazz.floatToInt(p2.y); +var z2 = Clazz.floatToInt(p2.z); +var xT1 = Clazz.doubleToInt(((x2 - Clazz.floatToInt(p0.x)) * tension) / 8); +var yT1 = Clazz.doubleToInt(((y2 - Clazz.floatToInt(p0.y)) * tension) / 8); +var zT1 = Clazz.doubleToInt(((z2 - Clazz.floatToInt(p0.z)) * tension) / 8); +var xT2 = Clazz.doubleToInt(((Clazz.floatToInt(p3.x) - x1) * tension) / 8); +var yT2 = Clazz.doubleToInt(((Clazz.floatToInt(p3.y) - y1) * tension) / 8); +var zT2 = Clazz.doubleToInt(((Clazz.floatToInt(p3.z) - z1) * tension) / 8); +this.pTopLeft[0].set(x1, y1, z1); +this.pTopRight[0].set(x2, y2, z2); +var x5 = Clazz.floatToInt(p5.x); +var y5 = Clazz.floatToInt(p5.y); +var z5 = Clazz.floatToInt(p5.z); +var x6 = Clazz.floatToInt(p6.x); +var y6 = Clazz.floatToInt(p6.y); +var z6 = Clazz.floatToInt(p6.z); +var xT5 = Clazz.doubleToInt(((x6 - Clazz.floatToInt(p4.x)) * tension) / 8); +var yT5 = Clazz.doubleToInt(((y6 - Clazz.floatToInt(p4.y)) * tension) / 8); +var zT5 = Clazz.doubleToInt(((z6 - Clazz.floatToInt(p4.z)) * tension) / 8); +var xT6 = Clazz.doubleToInt(((Clazz.floatToInt(p7.x) - x5) * tension) / 8); +var yT6 = Clazz.doubleToInt(((Clazz.floatToInt(p7.y) - y5) * tension) / 8); +var zT6 = Clazz.doubleToInt(((Clazz.floatToInt(p7.z) - z5) * tension) / 8); +this.pBotLeft[0].set(x5, y5, z5); +this.pBotRight[0].set(x6, y6, z6); +this.sLeft[0] = 0; +this.sRight[0] = 1; +this.needToFill[0] = true; +var sp = 0; +var closeEnd = false; +do { +var a = this.pTopLeft[sp]; +var b = this.pTopRight[sp]; +var dxTop = b.x - a.x; +var dxTop2 = dxTop * dxTop; +if (dxTop2 < 10) { +var dyTop = b.y - a.y; +var dyTop2 = dyTop * dyTop; +if (dyTop2 < 10) { +var c = this.pBotLeft[sp]; +var d = this.pBotRight[sp]; +var dxBot = d.x - c.x; +var dxBot2 = dxBot * dxBot; +if (dxBot2 < 8) { +var dyBot = d.y - c.y; +var dyBot2 = dyBot * dyBot; +if (dyBot2 < 8) { +if (border) { +this.g3d.fillSphereBits(3, a); +this.g3d.fillSphereBits(3, c); +}if (this.needToFill[sp]) { +if (aspectRatio > 0) { +this.T1.sub2(a, c); +this.T1.scale(ratio); +this.T2.sub2(a, b); +this.depth1.cross(this.T1, this.T2); +this.depth1.scale(this.T1.length() / this.depth1.length()); +this.a1.add2(a, this.depth1); +this.a2.sub2(a, this.depth1); +this.b1.add2(b, this.depth1); +this.b2.sub2(b, this.depth1); +this.c1.add2(c, this.depth1); +this.c2.sub2(c, this.depth1); +this.d1.add2(d, this.depth1); +this.d2.sub2(d, this.depth1); +this.g3d.fillQuadrilateral(this.a1, this.b1, this.d1, this.c1, false); +this.g3d.fillQuadrilateral(this.a2, this.b2, this.d2, this.c2, false); +this.g3d.fillQuadrilateral(this.a1, this.b1, this.b2, this.a2, false); +this.g3d.fillQuadrilateral(this.c1, this.d1, this.d2, this.c2, false); +closeEnd = true; +} else { +if (fillType == 0) { +if (isRev) this.g3d.fillQuadrilateral(c, d, b, a, false); + else this.g3d.fillQuadrilateral(a, b, d, c, false); +} else { +if (isRev) { +if (fillType != J.g3d.HermiteRenderer.isFront(a, b, d)) this.g3d.fillTriangle3f(a, b, d, false); +if (fillType != J.g3d.HermiteRenderer.isFront(a, d, c)) this.g3d.fillTriangle3f(a, d, c, false); +} else { +if (fillType == J.g3d.HermiteRenderer.isFront(a, b, d)) this.g3d.fillTriangle3f(a, b, d, false); +if (fillType == J.g3d.HermiteRenderer.isFront(a, d, c)) this.g3d.fillTriangle3f(a, d, c, false); +}}}this.needToFill[sp] = false; +}if (dxTop2 + dyTop2 < 2 && dxBot2 + dyBot2 < 2) { +--sp; +continue; +}}}}}var s = (this.sLeft[sp] + this.sRight[sp]) / 2; +var s2 = s * s; +var s3 = s2 * s; +var h1 = 2 * s3 - 3 * s2 + 1; +var h2 = -2 * s3 + 3 * s2; +var h3 = s3 - 2 * s2 + s; +var h4 = s3 - s2; +if (sp >= 15) break; +var spNext = sp + 1; +var pMidTop = this.pTopRight[spNext]; +pMidTop.x = (h1 * x1 + h2 * x2 + h3 * xT1 + h4 * xT2); +pMidTop.y = (h1 * y1 + h2 * y2 + h3 * yT1 + h4 * yT2); +pMidTop.z = (h1 * z1 + h2 * z2 + h3 * zT1 + h4 * zT2); +var pMidBot = this.pBotRight[spNext]; +pMidBot.x = (h1 * x5 + h2 * x6 + h3 * xT5 + h4 * xT6); +pMidBot.y = (h1 * y5 + h2 * y6 + h3 * yT5 + h4 * yT6); +pMidBot.z = (h1 * z5 + h2 * z6 + h3 * zT5 + h4 * zT6); +this.pTopRight[spNext] = this.pTopRight[sp]; +this.pTopRight[sp] = pMidTop; +this.pBotRight[spNext] = this.pBotRight[sp]; +this.pBotRight[sp] = pMidBot; +this.sRight[spNext] = this.sRight[sp]; +this.sRight[sp] = s; +this.needToFill[spNext] = this.needToFill[sp]; +this.pTopLeft[spNext].setT(pMidTop); +this.pBotLeft[spNext].setT(pMidBot); +this.sLeft[spNext] = s; +++sp; +} while (sp >= 0); +if (closeEnd) { +this.a1.z += 1; +this.c1.z += 1; +this.c2.z += 1; +this.a2.z += 1; +this.g3d.fillQuadrilateral(this.a1, this.c1, this.c2, this.a2, false); +}}, "~B,~B,~N,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,~N,~N"); +c$.isFront = Clazz.defineMethod(c$, "isFront", +function(a, b, c){ +J.g3d.HermiteRenderer.vAB.sub2(b, a); +J.g3d.HermiteRenderer.vAC.sub2(c, a); +J.g3d.HermiteRenderer.vAB.cross(J.g3d.HermiteRenderer.vAB, J.g3d.HermiteRenderer.vAC); +return (J.g3d.HermiteRenderer.vAB.z < 0 ? -1 : 1); +}, "JU.P3,JU.P3,JU.P3"); +Clazz.defineMethod(c$, "renderParallelPair", +function(fill, tension, p0, p1, p2, p3, p4, p5, p6, p7){ +var endPoints = Clazz.newArray(-1, [p2, p1, p6, p5]); +var points = new JU.Lst(); +var whichPoint = 0; +var numTopStrandPoints = 2; +var numPointsPerSegment = 5.0; +var interval = (1.0 / numPointsPerSegment); +var currentInt = 0.0; +var x1 = Clazz.floatToInt(p1.x); +var y1 = Clazz.floatToInt(p1.y); +var z1 = Clazz.floatToInt(p1.z); +var x2 = Clazz.floatToInt(p2.x); +var y2 = Clazz.floatToInt(p2.y); +var z2 = Clazz.floatToInt(p2.z); +var xT1 = Clazz.doubleToInt(((x2 - Clazz.floatToInt(p0.x)) * tension) / 8); +var yT1 = Clazz.doubleToInt(((y2 - Clazz.floatToInt(p0.y)) * tension) / 8); +var zT1 = Clazz.doubleToInt(((z2 - Clazz.floatToInt(p0.z)) * tension) / 8); +var xT2 = Clazz.doubleToInt(((Clazz.floatToInt(p3.x) - x1) * tension) / 8); +var yT2 = Clazz.doubleToInt(((Clazz.floatToInt(p3.y) - y1) * tension) / 8); +var zT2 = Clazz.doubleToInt(((Clazz.floatToInt(p3.z) - z1) * tension) / 8); +this.sLeft[0] = 0; +this.pLeft[0].set(x1, y1, z1); +this.sRight[0] = 1; +this.pRight[0].set(x2, y2, z2); +var sp = 0; +for (var strands = 2; strands > 0; strands--) { +if (strands == 1) { +x1 = Clazz.floatToInt(p5.x); +y1 = Clazz.floatToInt(p5.y); +z1 = Clazz.floatToInt(p5.z); +x2 = Clazz.floatToInt(p6.x); +y2 = Clazz.floatToInt(p6.y); +z2 = Clazz.floatToInt(p6.z); +xT1 = Clazz.doubleToInt(((x2 - Clazz.floatToInt(p4.x)) * tension) / 8); +yT1 = Clazz.doubleToInt(((y2 - Clazz.floatToInt(p4.y)) * tension) / 8); +zT1 = Clazz.doubleToInt(((z2 - Clazz.floatToInt(p4.z)) * tension) / 8); +xT2 = Clazz.doubleToInt(((Clazz.floatToInt(p7.x) - x1) * tension) / 8); +yT2 = Clazz.doubleToInt(((Clazz.floatToInt(p7.y) - y1) * tension) / 8); +zT2 = Clazz.doubleToInt(((Clazz.floatToInt(p7.z) - z1) * tension) / 8); +this.sLeft[0] = 0; +this.pLeft[0].set(x1, y1, z1); +this.sRight[0] = 1; +this.pRight[0].set(x2, y2, z2); +sp = 0; +}points.addLast(endPoints[whichPoint++]); +currentInt = interval; +do { +var a = this.pLeft[sp]; +var b = this.pRight[sp]; +var dx = b.x - a.x; +var dy = b.y - a.y; +var dist2 = dx * dx + dy * dy; +if (dist2 <= 2) { +var s = this.sLeft[sp]; +this.g3d.fillSphereI(3, a); +if (s < 1.0 - currentInt) { +var temp = new JU.P3(); +temp.set(a.x, a.y, a.z); +points.addLast(temp); +currentInt += interval; +if (strands == 2) { +numTopStrandPoints++; +}}--sp; +} else { +var s = (this.sLeft[sp] + this.sRight[sp]) / 2; +var s2 = s * s; +var s3 = s2 * s; +var h1 = 2 * s3 - 3 * s2 + 1; +var h2 = -2 * s3 + 3 * s2; +var h3 = s3 - 2 * s2 + s; +var h4 = s3 - s2; +if (sp >= 15) break; +var pMid = this.pRight[sp + 1]; +pMid.x = Clazz.doubleToInt(h1 * x1 + h2 * x2 + h3 * xT1 + h4 * xT2); +pMid.y = Clazz.doubleToInt(h1 * y1 + h2 * y2 + h3 * yT1 + h4 * yT2); +pMid.z = Clazz.doubleToInt(h1 * z1 + h2 * z2 + h3 * zT1 + h4 * zT2); +this.pRight[sp + 1] = this.pRight[sp]; +this.sRight[sp + 1] = this.sRight[sp]; +this.pRight[sp] = pMid; +this.sRight[sp] = s; +++sp; +this.pLeft[sp].setT(pMid); +this.sLeft[sp] = s; +}} while (sp >= 0); +points.addLast(endPoints[whichPoint++]); +} +var size = points.size(); +for (var top = 0; top < numTopStrandPoints && (top + numTopStrandPoints) < size; top++) this.g3d.drawLineAB(points.get(top), points.get(top + numTopStrandPoints)); + +}, "~B,~N,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3"); +c$.vAB = new JU.V3(); +c$.vAC = new JU.V3(); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/LineRenderer.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/LineRenderer.js new file mode 100755 index 000000000000..dcef43595f2d --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/LineRenderer.js @@ -0,0 +1,621 @@ +Clazz.declarePackage("J.g3d"); +Clazz.load(["J.g3d.PrecisionRenderer", "java.util.Hashtable"], "J.g3d.LineRenderer", ["JU.BS"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.g3d = null; +this.shader = null; +this.lineBits = null; +this.slope = 0; +this.lineTypeX = false; +this.nBits = 0; +this.lineCache = null; +this.slopeKey = null; +this.x1t = 0; +this.y1t = 0; +this.z1t = 0; +this.x2t = 0; +this.y2t = 0; +this.z2t = 0; +Clazz.instantialize(this, arguments);}, J.g3d, "LineRenderer", J.g3d.PrecisionRenderer); +Clazz.prepareFields (c$, function(){ +this.lineCache = new java.util.Hashtable(); +}); +Clazz.makeConstructor(c$, +function(g3d){ +Clazz.superConstructor (this, J.g3d.LineRenderer, []); +this.g3d = g3d; +this.shader = g3d.shader; +}, "J.g3d.Graphics3D"); +Clazz.defineMethod(c$, "setLineBits", +function(dx, dy){ +this.slope = (dx != 0 ? dy / dx : dy >= 0 ? 3.4028235E38 : -3.4028235E38); +this.lineTypeX = (this.slope <= 1 && this.slope >= -1); +this.nBits = (this.lineTypeX ? this.g3d.width : this.g3d.height); +this.slopeKey = Float.$valueOf(this.slope); +if (this.lineCache.containsKey(this.slopeKey)) { +this.lineBits = this.lineCache.get(this.slopeKey); +return; +}this.lineBits = JU.BS.newN(this.nBits); +dy = Math.abs(dy); +dx = Math.abs(dx); +if (dy > dx) { +var t = dx; +dx = dy; +dy = t; +}var twoDError = 0; +var twoDx = dx + dx; +var twoDy = dy + dy; +for (var i = 0; i < this.nBits; i++) { +twoDError += twoDy; +if (twoDError > dx) { +this.lineBits.set(i); +twoDError -= twoDx; +}} +this.lineCache.put(this.slopeKey, this.lineBits); +}, "~N,~N"); +Clazz.defineMethod(c$, "clearLineCache", +function(){ +this.lineCache.clear(); +}); +Clazz.defineMethod(c$, "plotLineOld", +function(argbA, argbB, xA, yA, zA, xB, yB, zB){ +this.x1t = xA; +this.x2t = xB; +this.y1t = yA; +this.y2t = yB; +this.z1t = zA; +this.z2t = zB; +var clipped = true; +switch (this.getTrimmedLineImpl()) { +case 0: +clipped = false; +break; +case 2: +return; +} +this.plotLineClippedOld(argbA, argbB, xA, yA, zA, xB - xA, yB - yA, zB - zA, clipped, 0, 0); +}, "~N,~N,~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "plotLineDeltaOld", +function(argbA, argbB, xA, yA, zA, dxBA, dyBA, dzBA, clipped){ +this.x1t = xA; +this.x2t = xA + dxBA; +this.y1t = yA; +this.y2t = yA + dyBA; +this.z1t = zA; +this.z2t = zA + dzBA; +if (clipped) switch (this.getTrimmedLineImpl()) { +case 2: +return; +case 0: +clipped = false; +break; +} +this.plotLineClippedOld(argbA, argbB, xA, yA, zA, dxBA, dyBA, dzBA, clipped, 0, 0); +}, "~N,~N,~N,~N,~N,~N,~N,~N,~B"); +Clazz.defineMethod(c$, "plotLineDeltaAOld", +function(shades1, shades2, screenMask, shadeIndex, x, y, z, dx, dy, dz, clipped){ +this.x1t = x; +this.x2t = x + dx; +this.y1t = y; +this.y2t = y + dy; +this.z1t = z; +this.z2t = z + dz; +if (clipped) switch (this.getTrimmedLineImpl()) { +case 2: +return; +case 0: +clipped = false; +} +var zbuf = this.g3d.zbuf; +var width = this.g3d.width; +var runIndex = 0; +var rise = 2147483647; +var run = 1; +var offset = y * width + x; +var offsetMax = this.g3d.bufferSize; +var shadeIndexUp = (shadeIndex < 63 ? shadeIndex + 1 : shadeIndex); +var shadeIndexDn = (shadeIndex > 0 ? shadeIndex - 1 : shadeIndex); +var argb1 = shades1[shadeIndex]; +var argb1Up = shades1[shadeIndexUp]; +var argb1Dn = shades1[shadeIndexDn]; +var argb2 = shades2[shadeIndex]; +var argb2Up = shades2[shadeIndexUp]; +var argb2Dn = shades2[shadeIndexDn]; +var argb = argb1; +var p = this.g3d.pixel; +if (screenMask != 0) { +p = this.g3d.setScreened((screenMask & 1) == 1); +this.g3d.currentShadeIndex = 0; +}if (argb != 0 && !clipped && offset >= 0 && offset < offsetMax && z < zbuf[offset]) p.addPixel(offset, z, argb); +if (dx == 0 && dy == 0) return; +var xIncrement = 1; +var yOffsetIncrement = width; +var x2 = x + dx; +var y2 = y + dy; +if (dx < 0) { +dx = -dx; +xIncrement = -1; +}if (dy < 0) { +dy = -dy; +yOffsetIncrement = -width; +}var twoDx = dx + dx; +var twoDy = dy + dy; +var zCurrentScaled = z << 10; +var argbUp = argb1Up; +var argbDn = argb1Dn; +if (dy <= dx) { +var roundingFactor = dx - 1; +if (dz < 0) roundingFactor = -roundingFactor; +var zIncrementScaled = Clazz.doubleToInt(((dz << 10) + roundingFactor) / dx); +var twoDxAccumulatedYError = 0; +var n1 = Math.abs(x2 - this.x2t) - 1; +var n2 = Math.abs(x2 - this.x1t) - 1; +for (var n = dx - 1, nMid = Clazz.doubleToInt(n / 2); --n >= n1; ) { +if (n == nMid) { +argb = argb2; +if (argb == 0) return; +argbUp = argb2Up; +argbDn = argb2Dn; +if (screenMask % 3 != 0) { +p = this.g3d.setScreened((screenMask & 2) == 2); +this.g3d.currentShadeIndex = 0; +}}offset += xIncrement; +zCurrentScaled += zIncrementScaled; +twoDxAccumulatedYError += twoDy; +if (twoDxAccumulatedYError > dx) { +offset += yOffsetIncrement; +twoDxAccumulatedYError -= twoDx; +}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) { +var zCurrent = zCurrentScaled >> 10; +if (zCurrent < zbuf[offset]) { +var rand8 = this.shader.nextRandom8Bit(); +p.addPixel(offset, zCurrent, rand8 < 85 ? argbDn : (rand8 > 170 ? argbUp : argb)); +}}runIndex = (runIndex + 1) % run; +} +} else { +var roundingFactor = dy - 1; +if (dz < 0) roundingFactor = -roundingFactor; +var zIncrementScaled = Clazz.doubleToInt(((dz << 10) + roundingFactor) / dy); +var twoDyAccumulatedXError = 0; +var n1 = Math.abs(y2 - this.y2t) - 1; +var n2 = Math.abs(y2 - this.y1t) - 1; +for (var n = dy - 1, nMid = Clazz.doubleToInt(n / 2); --n >= n1; ) { +if (n == nMid) { +argb = argb2; +if (argb == 0) return; +argbUp = argb2Up; +argbDn = argb2Dn; +if (screenMask % 3 != 0) { +p = this.g3d.setScreened((screenMask & 2) == 2); +this.g3d.currentShadeIndex = 0; +}}offset += yOffsetIncrement; +zCurrentScaled += zIncrementScaled; +twoDyAccumulatedXError += twoDx; +if (twoDyAccumulatedXError > dy) { +offset += xIncrement; +twoDyAccumulatedXError -= twoDy; +}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) { +var zCurrent = zCurrentScaled >> 10; +if (zCurrent < zbuf[offset]) { +var rand8 = this.g3d.shader.nextRandom8Bit(); +p.addPixel(offset, zCurrent, rand8 < 85 ? argbDn : (rand8 > 170 ? argbUp : argb)); +}}runIndex = (runIndex + 1) % run; +} +}}, "~A,~A,~N,~N,~N,~N,~N,~N,~N,~N,~B"); +Clazz.defineMethod(c$, "plotLineDeltaABitsFloat", +function(shades1, shades2, shadeIndex, ptA, ptB, screenMask, clipped){ +var x = Math.round(ptA.x); +var y = Math.round(ptA.y); +var z = Math.round(ptA.z); +var bx = Math.round(ptB.x); +var by = Math.round(ptB.y); +var bz = Math.round(ptB.z); +var dx = bx - x; +var dy = by - y; +this.x1t = x; +this.x2t = bx; +this.y1t = y; +this.y2t = by; +this.z1t = z; +this.z2t = bz; +if (clipped && this.getTrimmedLineImpl() == 2) return; +var zbuf = this.g3d.zbuf; +var width = this.g3d.width; +var runIndex = 0; +var rise = 2147483647; +var run = 1; +var shadeIndexUp = (shadeIndex < 63 ? shadeIndex + 1 : shadeIndex); +var shadeIndexDn = (shadeIndex > 0 ? shadeIndex - 1 : shadeIndex); +var argb1 = shades1[shadeIndex]; +var argb1Up = shades1[shadeIndexUp]; +var argb1Dn = shades1[shadeIndexDn]; +var argb2 = shades2[shadeIndex]; +var argb2Up = shades2[shadeIndexUp]; +var argb2Dn = shades2[shadeIndexDn]; +var offset = y * width + x; +var offsetMax = this.g3d.bufferSize; +var i0; +var iMid; +var i1; +var i2; +var iIncrement; +var xIncrement; +var yOffsetIncrement; +if (this.lineTypeX) { +i0 = x; +i1 = this.x1t; +i2 = this.x2t; +iMid = x + Clazz.doubleToInt(dx / 2); +iIncrement = (dx >= 0 ? 1 : -1); +xIncrement = iIncrement; +yOffsetIncrement = (dy >= 0 ? width : -width); +this.setRastABFloat(ptA.x, ptA.z, ptB.x, ptB.z); +} else { +i0 = y; +i1 = this.y1t; +i2 = this.y2t; +iMid = y + Clazz.doubleToInt(dy / 2); +iIncrement = (dy >= 0 ? 1 : -1); +xIncrement = (dy >= 0 ? width : -width); +yOffsetIncrement = (dx >= 0 ? 1 : -1); +this.setRastABFloat(ptA.y, ptA.z, ptB.y, ptB.z); +}var zCurrent = z; +var argb = argb1; +var argbUp = argb1Up; +var argbDn = argb1Dn; +var isInWindow = false; +var p = this.g3d.pixel; +if (screenMask != 0) { +p = this.g3d.setScreened((screenMask & 1) == 1); +this.g3d.currentShadeIndex = 0; +}for (var i = i0, iBits = i0; ; i += iIncrement, iBits += iIncrement) { +if (i == i1) isInWindow = true; +if (i == iMid) { +argb = argb2; +if (argb == 0) return; +argbUp = argb2Up; +argbDn = argb2Dn; +if (screenMask % 3 != 0) { +p = this.g3d.setScreened((screenMask & 2) == 2); +this.g3d.currentShadeIndex = 0; +}}if (argb != 0 && isInWindow && offset >= 0 && offset < offsetMax && runIndex < rise) { +zCurrent = this.getZCurrent(this.a, this.b, i); +if (zCurrent < zbuf[offset]) { +var rand8 = this.shader.nextRandom8Bit(); +p.addPixel(offset, Clazz.floatToInt(zCurrent), rand8 < 85 ? argbDn : (rand8 > 170 ? argbUp : argb)); +}}if (i == i2) break; +runIndex = (runIndex + 1) % run; +offset += xIncrement; +while (iBits < 0) iBits += this.nBits; + +if (this.lineBits.get(iBits % this.nBits)) { +offset += yOffsetIncrement; +}} +}, "~A,~A,~N,JU.P3,JU.P3,~N,~B"); +Clazz.defineMethod(c$, "plotLineDeltaABitsInt", +function(shades1, shades2, shadeIndex, ptA, ptB, screenMask, clipped){ +var x = ptA.x; +var y = ptA.y; +var z = ptA.z; +var bx = ptB.x; +var by = ptB.y; +var bz = ptB.z; +var dx = bx - x; +var dy = by - y; +this.x1t = x; +this.x2t = bx; +this.y1t = y; +this.y2t = by; +this.z1t = z; +this.z2t = bz; +if (clipped && this.getTrimmedLineImpl() == 2) return; +var zbuf = this.g3d.zbuf; +var width = this.g3d.width; +var runIndex = 0; +var rise = 2147483647; +var run = 1; +var shadeIndexUp = (shadeIndex < 63 ? shadeIndex + 1 : shadeIndex); +var shadeIndexDn = (shadeIndex > 0 ? shadeIndex - 1 : shadeIndex); +var argb1 = shades1[shadeIndex]; +var argb1Up = shades1[shadeIndexUp]; +var argb1Dn = shades1[shadeIndexDn]; +var argb2 = shades2[shadeIndex]; +var argb2Up = shades2[shadeIndexUp]; +var argb2Dn = shades2[shadeIndexDn]; +var offset = y * width + x; +var offsetMax = this.g3d.bufferSize; +var i0; +var iMid; +var i1; +var i2; +var iIncrement; +var xIncrement; +var yOffsetIncrement; +if (this.lineTypeX) { +i0 = x; +i1 = this.x1t; +i2 = this.x2t; +iMid = x + Clazz.doubleToInt(dx / 2); +iIncrement = (dx >= 0 ? 1 : -1); +xIncrement = iIncrement; +yOffsetIncrement = (dy >= 0 ? width : -width); +this.setRastAB(ptA.x, ptA.z, ptB.x, ptB.z); +} else { +i0 = y; +i1 = this.y1t; +i2 = this.y2t; +iMid = y + Clazz.doubleToInt(dy / 2); +iIncrement = (dy >= 0 ? 1 : -1); +xIncrement = (dy >= 0 ? width : -width); +yOffsetIncrement = (dx >= 0 ? 1 : -1); +this.setRastAB(ptA.y, ptA.z, ptB.y, ptB.z); +}var zCurrent = z; +var argb = argb1; +var argbUp = argb1Up; +var argbDn = argb1Dn; +var isInWindow = false; +var p = this.g3d.pixel; +if (screenMask != 0) { +p = this.g3d.setScreened((screenMask & 1) == 1); +this.g3d.currentShadeIndex = 0; +}for (var i = i0, iBits = i0; ; i += iIncrement, iBits += iIncrement) { +if (i == i1) isInWindow = true; +if (i == iMid) { +argb = argb2; +if (argb == 0) return; +argbUp = argb2Up; +argbDn = argb2Dn; +if (screenMask % 3 != 0) { +p = this.g3d.setScreened((screenMask & 2) == 2); +this.g3d.currentShadeIndex = 0; +}}if (argb != 0 && isInWindow && offset >= 0 && offset < offsetMax && runIndex < rise) { +zCurrent = this.getZCurrent(this.a, this.b, i); +if (zCurrent < zbuf[offset]) { +var rand8 = this.shader.nextRandom8Bit(); +p.addPixel(offset, Clazz.floatToInt(zCurrent), rand8 < 85 ? argbDn : (rand8 > 170 ? argbUp : argb)); +}}if (i == i2) break; +runIndex = (runIndex + 1) % run; +offset += xIncrement; +while (iBits < 0) iBits += this.nBits; + +if (this.lineBits.get(iBits % this.nBits)) { +offset += yOffsetIncrement; +}} +}, "~A,~A,~N,JU.P3i,JU.P3i,~N,~B"); +Clazz.defineMethod(c$, "plotLineBits", +function(argbA, argbB, ptA, ptB, run, rise, andClip){ +if (ptA.z <= 1 || ptB.z <= 1) return; +var clipped = true; +this.x1t = ptA.x; +this.y1t = ptA.y; +this.z1t = ptA.z; +this.x2t = ptB.x; +this.y2t = ptB.y; +this.z2t = ptB.z; +switch (this.getTrimmedLineImpl()) { +case 2: +return; +case 0: +clipped = false; +break; +default: +if (andClip) { +ptA.set(this.x1t, this.y1t, this.z1t); +ptB.set(this.x2t, this.y2t, this.z2t); +}} +var zbuf = this.g3d.zbuf; +var width = this.g3d.width; +var runIndex = 0; +if (run == 0) { +rise = 2147483647; +run = 1; +}var x = ptA.x; +var y = ptA.y; +var z = ptA.z; +var dx = ptB.x - x; +var x2 = x + dx; +var dy = ptB.y - y; +var y2 = y + dy; +var offset = y * width + x; +var offsetMax = this.g3d.bufferSize; +var argb = argbA; +var p = this.g3d.pixel; +if (argb != 0 && !clipped && offset >= 0 && offset < offsetMax && z < zbuf[offset]) p.addPixel(offset, z, argb); +if (dx == 0 && dy == 0) return; +var xIncrement = 1; +var yIncrement = 1; +var yOffsetIncrement = width; +if (dx < 0) { +dx = -dx; +xIncrement = -1; +}if (dy < 0) { +dy = -dy; +yOffsetIncrement = -width; +yIncrement = -1; +}var twoDx = dx + dx; +var twoDy = dy + dy; +if (dy <= dx) { +this.setRastAB(ptA.x, ptA.z, ptB.x, ptB.z); +var twoDxAccumulatedYError = 0; +var n1 = Math.abs(x2 - this.x2t) - 1; +var n2 = Math.abs(x2 - this.x1t) - 1; +for (var n = dx - 1, nMid = Clazz.doubleToInt(n / 2); --n >= n1; ) { +if (n == nMid) { +argb = argbB; +if (argb == 0) return; +}offset += xIncrement; +x += xIncrement; +twoDxAccumulatedYError += twoDy; +if (twoDxAccumulatedYError > dx) { +offset += yOffsetIncrement; +twoDxAccumulatedYError -= twoDx; +}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) { +var zCurrent = this.getZCurrent(this.a, this.b, x); +if (zCurrent < zbuf[offset]) p.addPixel(offset, zCurrent, argb); +}runIndex = (runIndex + 1) % run; +} +} else { +this.setRastAB(ptA.y, ptA.z, ptB.y, ptB.z); +var twoDyAccumulatedXError = 0; +var n1 = Math.abs(y2 - this.y2t) - 1; +var n2 = Math.abs(y2 - this.y1t) - 1; +for (var n = dy - 1, nMid = Clazz.doubleToInt(n / 2); --n >= n1; ) { +if (n == nMid) { +argb = argbB; +if (argb == 0) return; +}offset += yOffsetIncrement; +y += yIncrement; +twoDyAccumulatedXError += twoDx; +if (twoDyAccumulatedXError > dy) { +offset += xIncrement; +twoDyAccumulatedXError -= twoDy; +}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) { +var zCurrent = this.getZCurrent(this.a, this.b, y); +if (zCurrent < zbuf[offset]) p.addPixel(offset, zCurrent, argb); +}runIndex = (runIndex + 1) % run; +} +}}, "~N,~N,JU.P3i,JU.P3i,~N,~N,~B"); +Clazz.defineMethod(c$, "getTrimmedLineImpl", +function(){ +var cc1 = this.g3d.clipCode3(this.x1t, this.y1t, this.z1t); +var cc2 = this.g3d.clipCode3(this.x2t, this.y2t, this.z2t); +var c = (cc1 | cc2); +if ((cc1 | cc2) == 0) return 0; +if (c == -1) return 2; +var xLast = this.g3d.xLast; +var yLast = this.g3d.yLast; +var slab = this.g3d.slab; +var depth = this.g3d.depth; +do { +if ((cc1 & cc2) != 0) return 2; +var dx = this.x2t - this.x1t; +var dy = this.y2t - this.y1t; +var dz = this.z2t - this.z1t; +if (cc1 != 0) { +if ((cc1 & 8) != 0) { +this.y1t += Clazz.floatToInt((-this.x1t * dy) / dx); +this.z1t += Clazz.floatToInt((-this.x1t * dz) / dx); +this.x1t = 0; +} else if ((cc1 & 4) != 0) { +this.y1t += Clazz.floatToInt(((xLast - this.x1t) * dy) / dx); +this.z1t += Clazz.floatToInt(((xLast - this.x1t) * dz) / dx); +this.x1t = xLast; +} else if ((cc1 & 2) != 0) { +this.x1t += Clazz.floatToInt((-this.y1t * dx) / dy); +this.z1t += Clazz.floatToInt((-this.y1t * dz) / dy); +this.y1t = 0; +} else if ((cc1 & 1) != 0) { +this.x1t += Clazz.floatToInt(((yLast - this.y1t) * dx) / dy); +this.z1t += Clazz.floatToInt(((yLast - this.y1t) * dz) / dy); +this.y1t = yLast; +} else if ((cc1 & 32) != 0) { +this.x1t += Clazz.floatToInt(((slab - this.z1t) * dx) / dz); +this.y1t += Clazz.floatToInt(((slab - this.z1t) * dy) / dz); +this.z1t = slab; +} else { +this.x1t += Clazz.floatToInt(((depth - this.z1t) * dx) / dz); +this.y1t += Clazz.floatToInt(((depth - this.z1t) * dy) / dz); +this.z1t = depth; +}cc1 = this.g3d.clipCode3(this.x1t, this.y1t, this.z1t); +} else { +if ((cc2 & 8) != 0) { +this.y2t += Clazz.floatToInt((-this.x2t * dy) / dx); +this.z2t += Clazz.floatToInt((-this.x2t * dz) / dx); +this.x2t = 0; +} else if ((cc2 & 4) != 0) { +this.y2t += Clazz.floatToInt(((xLast - this.x2t) * dy) / dx); +this.z2t += Clazz.floatToInt(((xLast - this.x2t) * dz) / dx); +this.x2t = xLast; +} else if ((cc2 & 2) != 0) { +this.x2t += Clazz.floatToInt((-this.y2t * dx) / dy); +this.z2t += Clazz.floatToInt((-this.y2t * dz) / dy); +this.y2t = 0; +} else if ((cc2 & 1) != 0) { +this.x2t += Clazz.floatToInt(((yLast - this.y2t) * dx) / dy); +this.z2t += Clazz.floatToInt(((yLast - this.y2t) * dz) / dy); +this.y2t = yLast; +} else if ((cc2 & 32) != 0) { +this.x2t += Clazz.floatToInt(((slab - this.z2t) * dx) / dz); +this.y2t += Clazz.floatToInt(((slab - this.z2t) * dy) / dz); +this.z2t = slab; +} else { +this.x2t += Clazz.floatToInt(((depth - this.z2t) * dx) / dz); +this.y2t += Clazz.floatToInt(((depth - this.z2t) * dy) / dz); +this.z2t = depth; +}cc2 = this.g3d.clipCode3(this.x2t, this.y2t, this.z2t); +}} while ((cc1 | cc2) != 0); +return 1; +}); +Clazz.defineMethod(c$, "plotLineClippedOld", +function(argb1, argb2, x, y, z, dx, dy, dz, clipped, run, rise){ +var zbuf = this.g3d.zbuf; +var width = this.g3d.width; +var runIndex = 0; +if (run == 0) { +rise = 2147483647; +run = 1; +}var offset = y * width + x; +var offsetMax = this.g3d.bufferSize; +var argb = argb1; +var p = this.g3d.pixel; +if (argb != 0 && !clipped && offset >= 0 && offset < offsetMax && z < zbuf[offset]) p.addPixel(offset, z, argb); +if (dx == 0 && dy == 0) return; +var xIncrement = 1; +var yOffsetIncrement = width; +var x2 = x + dx; +var y2 = y + dy; +if (dx < 0) { +dx = -dx; +xIncrement = -1; +}if (dy < 0) { +dy = -dy; +yOffsetIncrement = -width; +}var twoDx = dx + dx; +var twoDy = dy + dy; +var zCurrentScaled = z << 10; +if (dy <= dx) { +var roundingFactor = dx - 1; +if (dz < 0) roundingFactor = -roundingFactor; +var zIncrementScaled = Clazz.doubleToInt(((dz << 10) + roundingFactor) / dx); +var twoDxAccumulatedYError = 0; +var n1 = Math.abs(x2 - this.x2t) - 1; +var n2 = Math.abs(x2 - this.x1t) - 1; +for (var n = dx - 1, nMid = Clazz.doubleToInt(n / 2); --n >= n1; ) { +if (n == nMid) { +argb = argb2; +if (argb == 0) return; +}offset += xIncrement; +zCurrentScaled += zIncrementScaled; +twoDxAccumulatedYError += twoDy; +if (twoDxAccumulatedYError > dx) { +offset += yOffsetIncrement; +twoDxAccumulatedYError -= twoDx; +}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) { +var zCurrent = zCurrentScaled >> 10; +if (zCurrent < zbuf[offset]) p.addPixel(offset, zCurrent, argb); +}runIndex = (runIndex + 1) % run; +} +} else { +var roundingFactor = dy - 1; +if (dz < 0) roundingFactor = -roundingFactor; +var zIncrementScaled = Clazz.doubleToInt(((dz << 10) + roundingFactor) / dy); +var twoDyAccumulatedXError = 0; +var n1 = Math.abs(y2 - this.y2t) - 1; +var n2 = Math.abs(y2 - this.y1t) - 1; +for (var n = dy - 1, nMid = Clazz.doubleToInt(n / 2); --n >= n1; ) { +if (n == nMid) { +argb = argb2; +if (argb == 0) return; +}offset += yOffsetIncrement; +zCurrentScaled += zIncrementScaled; +twoDyAccumulatedXError += twoDx; +if (twoDyAccumulatedXError > dy) { +offset += xIncrement; +twoDyAccumulatedXError -= twoDy; +}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) { +var zCurrent = zCurrentScaled >> 10; +if (zCurrent < zbuf[offset]) p.addPixel(offset, zCurrent, argb); +}runIndex = (runIndex + 1) % run; +} +}}, "~N,~N,~N,~N,~N,~N,~N,~N,~B,~N,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/Pixelator.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/Pixelator.js new file mode 100755 index 000000000000..cb9f7907b386 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/Pixelator.js @@ -0,0 +1,50 @@ +Clazz.declarePackage("J.g3d"); +Clazz.load(null, "J.g3d.Pixelator", ["J.g3d.Graphics3D"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.g = null; +this.p0 = null; +this.zb = null; +this.pb = null; +this.width = 0; +this.bgcolor = 0; +Clazz.instantialize(this, arguments);}, J.g3d, "Pixelator", null); +Clazz.makeConstructor(c$, +function(graphics3d){ +this.g = graphics3d; +this.bgcolor = this.g.bgcolor; +this.setBuf(); +}, "J.g3d.Graphics3D"); +Clazz.defineMethod(c$, "setBuf", +function(){ +this.zb = this.g.zbuf; +this.pb = this.g.pbuf; +}); +Clazz.defineMethod(c$, "clearPixel", +function(offset, z){ +if (this.zb[offset] > z) this.zb[offset] = 2147483647; +}, "~N,~N"); +Clazz.defineMethod(c$, "addPixel", +function(offset, z, p){ +this.zb[offset] = z; +this.pb[offset] = p; +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "addImagePixel", +function(shade, tLog, offset, z, argb, bgargb){ +if (z < this.zb[offset]) { +switch (shade) { +case 0: +return; +case 8: +this.addPixel(offset, z, argb); +return; +default: +shade += tLog; +if (shade <= 7) { +var p = this.pb[offset]; +if (bgargb != 0) p = J.g3d.Graphics3D.mergeBufferPixel(p, bgargb, bgargb); +p = J.g3d.Graphics3D.mergeBufferPixel(p, (argb & 0xFFFFFF) | (shade << 24), this.bgcolor); +this.addPixel(offset, z, p); +}} +}}, "~N,~N,~N,~N,~N,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/PixelatorScreened.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/PixelatorScreened.js new file mode 100755 index 000000000000..9299c6c2fcde --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/PixelatorScreened.js @@ -0,0 +1,15 @@ +Clazz.declarePackage("J.g3d"); +Clazz.load(["J.g3d.Pixelator"], "J.g3d.PixelatorScreened", null, function(){ +var c$ = Clazz.declareType(J.g3d, "PixelatorScreened", J.g3d.Pixelator); +Clazz.makeConstructor(c$, +function(g, p0){ +Clazz.superConstructor(this, J.g3d.PixelatorScreened, [g]); +this.width = g.width; +this.p0 = p0; +}, "J.g3d.Graphics3D,J.g3d.Pixelator"); +Clazz.overrideMethod(c$, "addPixel", +function(offset, z, p){ +if ((offset % this.width) % 2 == (Clazz.doubleToInt(offset / this.width)) % 2) this.p0.addPixel(offset, z, p); +}, "~N,~N,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/PixelatorShaded.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/PixelatorShaded.js new file mode 100755 index 000000000000..205c81b33b32 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/PixelatorShaded.js @@ -0,0 +1,51 @@ +Clazz.declarePackage("J.g3d"); +Clazz.load(["J.g3d.Pixelator"], "J.g3d.PixelatorShaded", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.bgRGB = null; +this.tmp = null; +this.zSlab = 0; +this.zDepth = 0; +this.zShadePower = 0; +Clazz.instantialize(this, arguments);}, J.g3d, "PixelatorShaded", J.g3d.Pixelator); +Clazz.makeConstructor(c$, +function(g){ +Clazz.superConstructor(this, J.g3d.PixelatorShaded, [g]); +this.tmp = Clazz.newIntArray (3, 0); +}, "J.g3d.Graphics3D"); +Clazz.defineMethod(c$, "set", +function(zSlab, zDepth, zShadePower){ +this.bgcolor = this.g.bgcolor; +this.bgRGB = Clazz.newIntArray(-1, [this.bgcolor & 0xFF, (this.bgcolor >> 8) & 0xFF, (this.g.bgcolor >> 16) & 0xFF]); +this.zSlab = zSlab < 0 ? 0 : zSlab; +this.zDepth = zDepth < 0 ? 0 : zDepth; +this.zShadePower = zShadePower; +this.p0 = this.g.pixel0; +return this; +}, "~N,~N,~N"); +Clazz.overrideMethod(c$, "addPixel", +function(offset, z, p){ +if (z > this.zDepth) return; +if (z >= this.zSlab && this.zShadePower > 0) { +var t = this.tmp; +var zs = this.bgRGB; +t[0] = p; +t[1] = p >> 8; +t[2] = p >> 16; +var f = (this.zDepth - z) / (this.zDepth - this.zSlab); +if (this.zShadePower > 1) for (var i = 0; i < this.zShadePower; i++) f *= f; + +for (var i = 0; i < 3; i++) t[i] = zs[i] + Clazz.floatToInt(f * ((t[i] & 0xFF) - zs[i])); + +p = (t[2] << 16) | (t[1] << 8) | t[0] | (p & 0xFF000000); +}this.p0.addPixel(offset, z, p); +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "showZBuffer", +function(){ +for (var i = this.p0.zb.length; --i >= 0; ) { +if (this.p0.pb[i] == 0) continue; +var z = Clazz.floatToInt(Math.min(255, Math.max(0, 255 * (this.zDepth - this.p0.zb[i]) / (this.zDepth - this.zSlab)))); +this.p0.pb[i] = 0xFF000000 | z | (z << 8) | (z << 16); +} +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/PixelatorT.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/PixelatorT.js new file mode 100755 index 000000000000..a38a4a2352d9 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/PixelatorT.js @@ -0,0 +1,20 @@ +Clazz.declarePackage("J.g3d"); +Clazz.load(["J.g3d.Pixelator"], "J.g3d.PixelatorT", ["J.g3d.Graphics3D"], function(){ +var c$ = Clazz.declareType(J.g3d, "PixelatorT", J.g3d.Pixelator); +Clazz.overrideMethod(c$, "clearPixel", +function(offset, z){ +}, "~N,~N"); +Clazz.overrideMethod(c$, "addPixel", +function(offset, z, p){ +var zT = this.g.zbufT[offset]; +if (z < zT) { +var argb = this.g.pbufT[offset]; +if (!this.g.translucentCoverOnly && argb != 0 && zT - z > this.g.zMargin) this.pb[offset] = J.g3d.Graphics3D.mergeBufferPixel(this.pb[offset], argb, this.g.bgcolor); +this.g.zbufT[offset] = z; +this.g.pbufT[offset] = p & this.g.translucencyMask; +} else if (z == zT) { +} else if (!this.g.translucentCoverOnly && z - zT > this.g.zMargin) { +this.pb[offset] = J.g3d.Graphics3D.mergeBufferPixel(this.pb[offset], p & this.g.translucencyMask, this.g.bgcolor); +}}, "~N,~N,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/Platform3D.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/Platform3D.js new file mode 100755 index 000000000000..3445a7422661 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/Platform3D.js @@ -0,0 +1,121 @@ +Clazz.declarePackage("J.g3d"); +(function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.windowWidth = 0; +this.windowHeight = 0; +this.windowSize = 0; +this.bufferWidth = 0; +this.bufferHeight = 0; +this.bufferSize = 0; +this.bufferSizeT = 0; +this.bufferedImage = null; +this.pBuffer = null; +this.pBufferT = null; +this.zBuffer = null; +this.zBufferT = null; +this.widthOffscreen = 0; +this.heightOffscreen = 0; +this.offscreenImage = null; +this.graphicsForTextOrImage = null; +this.apiPlatform = null; +Clazz.instantialize(this, arguments);}, J.g3d, "Platform3D", null); +Clazz.makeConstructor(c$, +function(apiPlatform){ +this.apiPlatform = apiPlatform; +}, "J.api.GenericPlatform"); +Clazz.defineMethod(c$, "getGraphicsForMetrics", +function(){ +return this.apiPlatform.getGraphics(this.allocateOffscreenImage(1, 1)); +}); +Clazz.defineMethod(c$, "allocateTBuffers", +function(antialiasTranslucent){ +this.bufferSizeT = (antialiasTranslucent ? this.bufferSize : this.windowSize); +this.zBufferT = Clazz.newIntArray (this.bufferSizeT, 0); +this.pBufferT = Clazz.newIntArray (this.bufferSizeT, 0); +}, "~B"); +Clazz.defineMethod(c$, "allocateBuffers", +function(width, height, antialias, isImageWrite){ +this.windowWidth = width; +this.windowHeight = height; +this.windowSize = width * height; +if (antialias) { +width *= 2; +height *= 2; +}this.bufferWidth = width; +this.bufferHeight = height; +this.bufferSize = this.bufferWidth * this.bufferHeight; +this.zBuffer = Clazz.newIntArray (this.bufferSize, 0); +this.pBuffer = Clazz.newIntArray (this.bufferSize, 0); +this.bufferedImage = this.apiPlatform.allocateRgbImage(this.windowWidth, this.windowHeight, this.pBuffer, this.windowSize, J.g3d.Platform3D.backgroundTransparent, isImageWrite); +}, "~N,~N,~B,~B"); +Clazz.defineMethod(c$, "releaseBuffers", +function(){ +this.windowWidth = this.windowHeight = this.bufferWidth = this.bufferHeight = this.bufferSize = -1; +if (this.bufferedImage != null) { +this.apiPlatform.flushImage(this.bufferedImage); +this.bufferedImage = null; +}this.pBuffer = null; +this.zBuffer = null; +this.pBufferT = null; +this.zBufferT = null; +}); +Clazz.defineMethod(c$, "hasContent", +function(){ +for (var i = this.bufferSize; --i >= 0; ) if (this.zBuffer[i] != 2147483647) return true; + +return false; +}); +Clazz.defineMethod(c$, "clearScreenBuffer", +function(){ +for (var i = this.bufferSize; --i >= 0; ) { +this.zBuffer[i] = 2147483647; +this.pBuffer[i] = 0; +} +}); +Clazz.defineMethod(c$, "setBackgroundColor", +function(bgColor){ +if (this.pBuffer == null) return; +for (var i = this.bufferSize; --i >= 0; ) if (this.pBuffer[i] == 0) this.pBuffer[i] = bgColor; + +}, "~N"); +Clazz.defineMethod(c$, "clearTBuffer", +function(){ +for (var i = this.bufferSizeT; --i >= 0; ) { +this.zBufferT[i] = 2147483647; +this.pBufferT[i] = 0; +} +}); +Clazz.defineMethod(c$, "clearBuffer", +function(){ +this.clearScreenBuffer(); +}); +Clazz.defineMethod(c$, "clearScreenBufferThreaded", +function(){ +}); +Clazz.defineMethod(c$, "notifyEndOfRendering", +function(){ +this.apiPlatform.notifyEndOfRendering(); +}); +Clazz.defineMethod(c$, "getGraphicsForTextOrImage", +function(width, height){ +if (width > this.widthOffscreen || height > this.heightOffscreen) { +if (this.offscreenImage != null) { +this.apiPlatform.disposeGraphics(this.graphicsForTextOrImage); +this.apiPlatform.flushImage(this.offscreenImage); +}if (width > this.widthOffscreen) this.widthOffscreen = width; +if (height > this.heightOffscreen) this.heightOffscreen = height; +this.offscreenImage = this.allocateOffscreenImage(this.widthOffscreen, this.heightOffscreen); +this.graphicsForTextOrImage = this.apiPlatform.getStaticGraphics(this.offscreenImage, J.g3d.Platform3D.backgroundTransparent); +}return this.graphicsForTextOrImage; +}, "~N,~N"); +Clazz.defineMethod(c$, "allocateOffscreenImage", +function(width, height){ +return this.apiPlatform.newOffScreenImage(width, height); +}, "~N,~N"); +Clazz.defineMethod(c$, "setBackgroundTransparent", +function(tf){ +J.g3d.Platform3D.backgroundTransparent = tf; +}, "~B"); +c$.backgroundTransparent = false; +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/PrecisionRenderer.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/PrecisionRenderer.js new file mode 100755 index 000000000000..1986d129dc0f --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/PrecisionRenderer.js @@ -0,0 +1,43 @@ +Clazz.declarePackage("J.g3d"); +(function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.a = 0; +this.b = 0; +this.isOrthographic = false; +Clazz.instantialize(this, arguments);}, J.g3d, "PrecisionRenderer", null); +Clazz.defineMethod(c$, "getZCurrent", +function(a, b, x){ +return Math.round(a == 1.4E-45 ? b : this.isOrthographic ? a * x + b : a / (b - x)); +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "setRastABFloat", +function(xa, za, xb, zb){ +var zdif = (zb - za); +var xdif = (xb - xa); +if (zdif == 0 || xdif == 0) { +this.a = 1.4E-45; +this.b = za; +return; +}if (this.isOrthographic) { +this.a = zdif / xdif; +this.b = za - this.a * xa; +} else { +this.a = xdif * za * (zb / zdif); +this.b = (xb * zb - xa * za) / zdif; +}}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "setRastAB", +function(xa, za, xb, zb){ +var zdif = (zb - za); +var xdif = (xb - xa); +if (xa == 1.4E-45 || zdif == 0 || xdif == 0) { +this.a = 1.4E-45; +this.b = zb; +return; +}if (this.isOrthographic) { +this.a = zdif / xdif; +this.b = za - this.a * xa; +} else { +this.a = xdif * za * (zb / zdif); +this.b = (xb * zb - xa * za) / zdif; +}}, "~N,~N,~N,~N"); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/SphereRenderer.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/SphereRenderer.js new file mode 100755 index 000000000000..d61d3d71413c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/SphereRenderer.js @@ -0,0 +1,392 @@ +Clazz.declarePackage("J.g3d"); +Clazz.load(["JU.P3"], "J.g3d.SphereRenderer", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.g3d = null; +this.shader = null; +this.zroot = null; +this.mat = null; +this.coef = null; +this.mDeriv = null; +this.selectedOctant = 0; +this.planeShade = 0; +this.zbuf = null; +this.width = 0; +this.height = 0; +this.depth = 0; +this.slab = 0; +this.offsetPbufBeginLine = 0; +this.ptTemp = null; +this.planeShades = null; +this.dxyz = null; +Clazz.instantialize(this, arguments);}, J.g3d, "SphereRenderer", null); +Clazz.prepareFields (c$, function(){ +this.zroot = Clazz.newDoubleArray (2, 0); +this.ptTemp = new JU.P3(); +this.planeShades = Clazz.newIntArray (3, 0); +this.dxyz = Clazz.newFloatArray (3, 3, 0); +}); +Clazz.makeConstructor(c$, +function(g3d){ +this.g3d = g3d; +this.shader = g3d.shader; +}, "J.g3d.Graphics3D"); +Clazz.defineMethod(c$, "render", +function(shades, diameter, x, y, z, mat, coef, mDeriv, selectedOctant, octantPoints){ +if (z == 1) return; +if (diameter > 49) diameter &= -2; +if (this.g3d.isClippedXY(diameter, x, y)) return; +this.slab = this.g3d.slab; +this.depth = this.g3d.depth; +var radius = (diameter + 1) >> 1; +var minZ = z - radius; +if (z + radius < this.slab || minZ > this.depth) return; +var minX = x - radius; +var maxX = x + radius; +var minY = y - radius; +var maxY = y + radius; +this.shader.nOut = this.shader.nIn = 0; +this.zbuf = this.g3d.zbuf; +this.height = this.g3d.height; +this.width = this.g3d.width; +this.offsetPbufBeginLine = this.width * y + x; +var sh = this.shader; +this.mat = mat; +if (mat != null) { +this.coef = coef; +this.mDeriv = mDeriv; +this.selectedOctant = selectedOctant; +if (sh.ellipsoidShades == null) sh.createEllipsoidShades(); +if (octantPoints != null) { +this.planeShade = -1; +for (var i = 0; i < 3; i++) { +var dx = this.dxyz[i][0] = octantPoints[i].x - x; +var dy = this.dxyz[i][1] = octantPoints[i].y - y; +var dz = this.dxyz[i][2] = octantPoints[i].z - z; +this.planeShades[i] = sh.getShadeIndex(dx, dy, -dz); +if (dx == 0 && dy == 0) { +this.planeShade = this.planeShades[i]; +break; +}} +}}if (mat != null || diameter > 128) { +this.renderQuadrant(-1, -1, x, y, z, diameter, shades); +this.renderQuadrant(-1, 1, x, y, z, diameter, shades); +this.renderQuadrant(1, -1, x, y, z, diameter, shades); +this.renderQuadrant(1, 1, x, y, z, diameter, shades); +if (mat != null) { +this.mat = null; +this.coef = null; +this.mDeriv = null; +}} else { +var ss = sh.sphereShapeCache[diameter - 1]; +if (ss == null) { +var countSE = 0; +var d = (diameter & 1) != 0; +var radiusF = diameter / 2.0; +var radiusF2 = radiusF * radiusF; +radius = Clazz.doubleToInt((diameter + 1) / 2); +var ys = d ? 0 : 0.5; +for (var i = 0; i < radius; ++i, ++ys) { +var y2 = ys * ys; +var xs = d ? 0 : 0.5; +for (var j = 0; j < radius; ++j, ++xs) { +var x2 = xs * xs; +var z2 = radiusF2 - y2 - x2; +if (z2 >= 0) ++countSE; +} +} +ss = Clazz.newIntArray (countSE, 0); +var offset = 0; +ys = d ? 0 : 0.5; +for (var i = 0; i < radius; ++i, ++ys) { +var y2 = ys * ys; +var xs = d ? 0 : 0.5; +for (var j = 0; j < radius; ++j, ++xs) { +var x2 = xs * xs; +var z2 = radiusF2 - y2 - x2; +if (z2 >= 0) { +var zs = Math.sqrt(z2); +var height = Clazz.floatToInt(zs); +var shadeIndexSE = sh.getShadeN(xs, ys, zs, radiusF); +var shadeIndexSW = sh.getShadeN(-xs, ys, zs, radiusF); +var shadeIndexNE = sh.getShadeN(xs, -ys, zs, radiusF); +var shadeIndexNW = sh.getShadeN(-xs, -ys, zs, radiusF); +var packed = (height | (shadeIndexSE << 7) | (shadeIndexSW << 13) | (shadeIndexNE << 19) | (shadeIndexNW << 25)); +ss[offset++] = packed; +}} +ss[offset - 1] |= 0x80000000; +} +sh.sphereShapeCache[diameter - 1] = ss; +}if (minX < 0 || maxX >= this.width || minY < 0 || maxY >= this.height || minZ < this.slab || z > this.depth) this.renderSphereClipped(ss, x, y, z, diameter, shades); + else this.renderSphereUnclipped(ss, z, diameter, shades); +}this.zbuf = null; +}, "~A,~N,~N,~N,~N,JU.M3,~A,JU.M4,~N,~A"); +Clazz.defineMethod(c$, "renderSphereUnclipped", +function(sphereShape, z, diameter, shades){ +var offsetSphere = 0; +var evenSizeCorrection = 1 - (diameter & 1); +var offsetSouthCenter = this.offsetPbufBeginLine; +var offsetNorthCenter = offsetSouthCenter - evenSizeCorrection * this.width; +var nLines = Clazz.doubleToInt((diameter + 1) / 2); +var zbuf = this.zbuf; +var width = this.width; +var p = this.g3d.pixel; +do { +var offsetSE = offsetSouthCenter; +var offsetSW = offsetSouthCenter - evenSizeCorrection; +var offsetNE = offsetNorthCenter; +var offsetNW = offsetNorthCenter - evenSizeCorrection; +var packed; +do { +packed = sphereShape[offsetSphere++]; +var zPixel = z - (packed & 0x7F); +if (zPixel < zbuf[offsetSE]) p.addPixel(offsetSE, zPixel, shades[((packed >> 7) & 0x3F)]); +if (zPixel < zbuf[offsetSW]) p.addPixel(offsetSW, zPixel, shades[((packed >> 13) & 0x3F)]); +if (zPixel < zbuf[offsetNE]) p.addPixel(offsetNE, zPixel, shades[((packed >> 19) & 0x3F)]); +if (zPixel < zbuf[offsetNW]) p.addPixel(offsetNW, zPixel, shades[((packed >> 25) & 0x3F)]); +++offsetSE; +--offsetSW; +++offsetNE; +--offsetNW; +} while (packed >= 0); +offsetSouthCenter += width; +offsetNorthCenter -= width; +} while (--nLines > 0); +}, "~A,~N,~N,~A"); +Clazz.defineMethod(c$, "renderSphereClipped", +function(sphereShape, x, y, z, diameter, shades){ +var w = this.width; +var h = this.height; +var offsetSphere = 0; +var evenSizeCorrection = 1 - (diameter & 1); +var offsetSouthCenter = this.offsetPbufBeginLine; +var offsetNorthCenter = offsetSouthCenter - evenSizeCorrection * w; +var nLines = Clazz.doubleToInt((diameter + 1) / 2); +var ySouth = y; +var yNorth = y - evenSizeCorrection; +var randu = (x << 16) + (y << 1) ^ 0x33333333; +var sh = shades; +var zb = this.zbuf; +var p = this.g3d.pixel; +var sl = this.slab; +var de = this.depth; +do { +var tSouthVisible = ySouth >= 0 && ySouth < h; +var tNorthVisible = yNorth >= 0 && yNorth < h; +var offsetSE = offsetSouthCenter; +var offsetSW = offsetSouthCenter - evenSizeCorrection; +var offsetNE = offsetNorthCenter; +var offsetNW = offsetNorthCenter - evenSizeCorrection; +var packed; +var xEast = x; +var xWest = x - evenSizeCorrection; +do { +var tWestVisible = xWest >= 0 && xWest < w; +var tEastVisible = xEast >= 0 && xEast < w; +packed = sphereShape[offsetSphere++]; +var isCore; +var zOffset = packed & 0x7F; +var zPixel; +if (z < sl) { +zPixel = z + zOffset; +isCore = (zPixel >= sl); +} else { +zPixel = z - zOffset; +isCore = (zPixel < sl); +}if (isCore) zPixel = sl; +if (zPixel >= sl && zPixel <= de) { +if (tSouthVisible) { +if (tEastVisible && zPixel < zb[offsetSE]) { +var i = (isCore ? 44 + ((randu >> 7) & 0x07) : (packed >> 7) & 0x3F); +p.addPixel(offsetSE, zPixel, sh[i]); +}if (tWestVisible && zPixel < zb[offsetSW]) { +var i = (isCore ? 44 + ((randu >> 13) & 0x07) : (packed >> 13) & 0x3F); +p.addPixel(offsetSW, zPixel, sh[i]); +}}if (tNorthVisible) { +if (tEastVisible && zPixel < zb[offsetNE]) { +var i = (isCore ? 44 + ((randu >> 19) & 0x07) : (packed >> 19) & 0x3F); +p.addPixel(offsetNE, zPixel, sh[i]); +}if (tWestVisible && zPixel < zb[offsetNW]) { +var i = (isCore ? 44 + ((randu >> 25) & 0x07) : (packed >> 25) & 0x3F); +p.addPixel(offsetNW, zPixel, sh[i]); +}}}++offsetSE; +--offsetSW; +++offsetNE; +--offsetNW; +++xEast; +--xWest; +if (isCore) randu = ((randu << 16) + (randu << 1) + randu) & 0x7FFFFFFF; +} while (packed >= 0); +offsetSouthCenter += w; +offsetNorthCenter -= w; +++ySouth; +--yNorth; +} while (--nLines > 0); +}, "~A,~N,~N,~N,~N,~A"); +Clazz.defineMethod(c$, "renderQuadrant", +function(xSign, ySign, x, y, z, diameter, shades){ +var radius = Clazz.doubleToInt(diameter / 2); +var t = x + radius * xSign; +var xStatus = (x < 0 ? -1 : x < this.width ? 0 : 1) + (t < 0 ? -2 : t < this.width ? 0 : 2); +if (xStatus == -3 || xStatus == 3) return; +t = y + radius * ySign; +var yStatus = (y < 0 ? -1 : y < this.height ? 0 : 1) + (t < 0 ? -2 : t < this.height ? 0 : 2); +if (yStatus == -3 || yStatus == 3) return; +var unclipped = (this.mat == null && xStatus == 0 && yStatus == 0 && z - radius >= this.slab && z <= this.depth); +if (unclipped) this.renderQuadrantUnclipped(radius, xSign, ySign, z, shades); + else this.renderQuadrantClipped(radius, xSign, ySign, x, y, z, shades); +}, "~N,~N,~N,~N,~N,~N,~A"); +Clazz.defineMethod(c$, "renderQuadrantUnclipped", +function(radius, xSign, ySign, z, s){ +var r2 = radius * radius; +var dDivisor = radius * 2 + 1; +var lineIncrement = (ySign < 0 ? -this.width : this.width); +var ptLine = this.offsetPbufBeginLine; +var zb = this.zbuf; +var p = this.g3d.pixel; +var indexes = this.shader.sphereShadeIndexes; +for (var i = 0, i2 = 0; i2 <= r2; i2 += i + (++i), ptLine += lineIncrement) { +var offset = ptLine; +var s2 = r2 - i2; +var z0 = z - radius; +var y8 = Clazz.doubleToInt(((i * ySign + radius) << 8) / dDivisor); +for (var j = 0, j2 = 0; j2 <= s2; j2 += j + (++j), offset += xSign) { +if (zb[offset] <= z0) continue; +var k = Clazz.doubleToInt(Math.sqrt(s2 - j2)); +z0 = z - k; +if (zb[offset] <= z0) continue; +var x8 = Clazz.doubleToInt(((j * xSign + radius) << 8) / dDivisor); +p.addPixel(offset, z0, s[indexes[((y8 << 8) + x8)]]); +} +} +}, "~N,~N,~N,~N,~A"); +Clazz.defineMethod(c$, "renderQuadrantClipped", +function(radius, xSign, ySign, x, y, z, shades){ +var isEllipsoid = (this.mat != null); +var checkOctant = (this.selectedOctant >= 0); +var r2 = radius * radius; +var dDivisor = radius * 2 + 1; +var lineIncrement = (ySign < 0 ? -this.width : this.width); +var ptLine = this.offsetPbufBeginLine; +var randu = (x << 16) + (y << 1) ^ 0x33333333; +var y8 = 0; +var iShade = 0; +var p = this.g3d.pixel; +var z1 = 0; +var h = this.height; +var w = this.width; +var x0 = x; +var zb = this.zbuf; +var xyz = this.dxyz; +var y0 = y; +var z0 = z; +var sl = this.slab; +var de = this.depth; +var pt = this.ptTemp; +var c = this.coef; +var rt = this.zroot; +var oct = this.selectedOctant; +var s = this.shader; +var pl = this.planeShades; +var indexes = s.sphereShadeIndexes; +var ps = this.planeShade; +var m = this.mat; +for (var i = 0, i2 = 0, yC = y; i2 <= r2; i2 += i + (++i), ptLine += lineIncrement, yC += ySign) { +if (yC < 0) { +if (ySign < 0) return; +continue; +}if (yC >= h) { +if (ySign > 0) return; +continue; +}var s2 = r2 - (isEllipsoid ? 0 : i2); +if (!isEllipsoid) { +y8 = Clazz.doubleToInt(((i * ySign + radius) << 8) / dDivisor); +}randu = ((randu << 16) + (randu << 1) + randu) & 0x7FFFFFFF; +var xC = x0; +for (var j = 0, j2 = 0, iRoot = -1, mode = 1, offset = ptLine; j2 <= s2; j2 += j + (++j), offset += xSign, xC += xSign) { +if (xC < 0) { +if (xSign < 0) break; +continue; +}if (xC >= w) { +if (xSign > 0) break; +continue; +}var zPixel; +if (isEllipsoid) { +var b_2a = (c[4] * xC + c[5] * yC + c[8]) / c[2] / 2; +var c_a = (c[0] * xC * xC + c[1] * yC * yC + c[3] * xC * yC + c[6] * xC + c[7] * yC - 1) / c[2]; +var f = b_2a * b_2a - c_a; +if (f < 0) { +if (iRoot >= 0) { +break; +}continue; +}f = Math.sqrt(f); +rt[0] = (-b_2a - f); +rt[1] = (-b_2a + f); +iRoot = (z0 < sl ? 1 : 0); +if ((zPixel = Clazz.doubleToInt(rt[iRoot])) == 0) zPixel = z0; +mode = 2; +z1 = zPixel; +if (checkOctant) { +pt.set(xC - x0, yC - y0, zPixel - z0); +m.rotate(pt); +var thisOctant = 0; +if (pt.x < 0) thisOctant |= 1; +if (pt.y < 0) thisOctant |= 2; +if (pt.z < 0) thisOctant |= 4; +if (thisOctant == oct) { +if (ps >= 0) { +iShade = ps; +} else { +var iMin = 3; +var dz; +var zMin = 3.4028235E38; +for (var ii = 0; ii < 3; ii++) { +if ((dz = xyz[ii][2]) == 0) continue; +var ptz = z0 + (-xyz[ii][0] * (xC - x) - xyz[ii][1] * (yC - y0)) / dz; +if (ptz < zMin) { +zMin = ptz; +iMin = ii; +}} +if (iMin == 3) { +iMin = 0; +zMin = z0; +}rt[0] = zMin; +iShade = pl[iMin]; +}zPixel = Clazz.doubleToInt(rt[0]); +mode = 3; +}var isCore = (z0 < sl ? zPixel >= sl : zPixel < sl); +if (isCore) { +z1 = zPixel = sl; +mode = 0; +}}if (zPixel < sl || zPixel > de || zb[offset] <= z1) continue; +} else { +var zOffset = Clazz.doubleToInt(Math.sqrt(s2 - j2)); +zPixel = z0 + (z0 < sl ? zOffset : -zOffset); +var isCore = (z0 < sl ? zPixel >= sl : zPixel < sl); +if (isCore) { +zPixel = sl; +mode = 0; +}if (zPixel < sl || zPixel > de || zb[offset] <= zPixel) continue; +}switch (mode) { +case 0: +iShade = (44 + ((randu >> 8) & 0x07)); +randu = ((randu << 16) + (randu << 1) + randu) & 0x7FFFFFFF; +mode = 1; +break; +case 2: +iShade = s.getEllipsoidShade(xC, yC, rt[iRoot], radius, this.mDeriv); +break; +case 3: +p.clearPixel(offset, z1); +break; +default: +var x8 = Clazz.doubleToInt(((j * xSign + radius) << 8) / dDivisor); +iShade = indexes[(y8 << 8) + x8]; +break; +} +p.addPixel(offset, zPixel, shades[iShade]); +} +randu = ((randu + xC + yC) | 1) & 0x7FFFFFFF; +} +}, "~N,~N,~N,~N,~N,~N,~A"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/TextRenderer.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/TextRenderer.js new file mode 100755 index 000000000000..fe9937d958de --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/TextRenderer.js @@ -0,0 +1,140 @@ +Clazz.declarePackage("J.g3d"); +Clazz.load(["java.util.Hashtable"], "J.g3d.TextRenderer", ["JU.CU", "J.g3d.Graphics3D"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.height = 0; +this.ascent = 0; +this.width = 0; +this.mapWidth = 0; +this.size = 0; +this.tmap = null; +this.isInvalid = false; +Clazz.instantialize(this, arguments);}, J.g3d, "TextRenderer", null); +Clazz.makeConstructor(c$, +function(text, font3d){ +this.ascent = font3d.getAscent(); +this.height = font3d.getHeight(); +this.width = font3d.stringWidth(text); +if (this.width == 0) return; +this.mapWidth = this.width; +this.size = this.mapWidth * this.height; +}, "~S,JU.Font"); +c$.clearFontCache = Clazz.defineMethod(c$, "clearFontCache", +function(){ +if (J.g3d.TextRenderer.working) return; +J.g3d.TextRenderer.htFont3d.clear(); +J.g3d.TextRenderer.htFont3dAntialias.clear(); +}); +c$.plot = Clazz.defineMethod(c$, "plot", +function(x, y, z, argb, bgargb, text, font3d, g3d, jr, antialias){ +if (text.length == 0) return 0; +if (text.indexOf(" = 0 || text.indexOf(" = 0) return J.g3d.TextRenderer.plotByCharacter(x, y, z, argb, bgargb, text, font3d, g3d, jr, antialias); +var offset = font3d.getAscent(); +y -= offset; +var text3d = J.g3d.TextRenderer.getPlotText3D(x, y, g3d, text, font3d, antialias); +if (text3d.isInvalid) return text3d.width; +if (antialias) argb = J.g3d.Graphics3D.fixTextImageRGB(argb); +var textHeight = text3d.height; +var textWidth = text3d.width; +var tmap = text3d.tmap; +var g = g3d; +var width = g.width; +var height = g.height; +var zbuf = g.zbuf; +var p = g.pixel; +var tLog = g.translucencyLog; +if (jr != null || (x < 0 || x + text3d.width > width || y < 0 || y + text3d.height > height) && (jr = g3d) != null) { +for (var off = 0, i = 0; i < textHeight; i++) { +for (var j = 0; j < textWidth; j++) { +var shade = tmap[off++]; +if (shade != 0) jr.plotImagePixel(argb, x + j, y + i, z, shade, bgargb, width, height, zbuf, p, tLog); +} +} +} else { +for (var i = 0, off = 0, pbufOffset = y * width + x; i < textHeight; i++, pbufOffset += (width - textWidth)) for (var j = 0; j < textWidth; j++) p.addImagePixel(tmap[off++], tLog, pbufOffset++, z, argb, bgargb); + + +}return text3d.width; +}, "~N,~N,~N,~N,~N,~S,JU.Font,J.g3d.Graphics3D,J.api.JmolRendererInterface,~B"); +c$.plotByCharacter = Clazz.defineMethod(c$, "plotByCharacter", +function(x, y, z, argb, bgargb, text, font3d, g3d, jmolRenderer, antialias){ +var w = 0; +var len = text.length; +var suboffset = Math.round(font3d.getHeight() * 0.25); +var supoffset = -Math.round(font3d.getHeight() * 0.3); +var argb0 = 0; +for (var i = 0; i < len; i++) { +if (text.charAt(i) == '<') { +if (i + 5 < len && text.substring(i, i + 6).equals(" ", i); +if (pt < 0) continue; +argb = JU.CU.getArgbFromString(text.substring(i + 7, pt).trim()); +i = pt; +continue; +}if (i + 7 < len && text.substring(i, i + 8).equals(" ")) { +i += 7; +argb = argb0; +continue; +}if (i + 4 < len && text.substring(i, i + 5).equals("")) { +i += 4; +y += suboffset; +continue; +}if (i + 4 < len && text.substring(i, i + 5).equals("")) { +i += 4; +y += supoffset; +continue; +}if (i + 5 < len && text.substring(i, i + 6).equals("")) { +i += 5; +y -= suboffset; +continue; +}if (i + 5 < len && text.substring(i, i + 6).equals("")) { +i += 5; +y -= supoffset; +continue; +}}var width = J.g3d.TextRenderer.plot(x + w, y, z, argb, bgargb, text.substring(i, i + 1), font3d, g3d, jmolRenderer, antialias); +w += width; +} +return w; +}, "~N,~N,~N,~N,~N,~S,JU.Font,J.g3d.Graphics3D,J.api.JmolRendererInterface,~B"); +c$.getPlotText3D = Clazz.defineMethod(c$, "getPlotText3D", +function(x, y, g3d, text, font3d, antialias){ +J.g3d.TextRenderer.working = true; +var ht = (antialias ? J.g3d.TextRenderer.htFont3dAntialias : J.g3d.TextRenderer.htFont3d); +var htForThisFont = ht.get(font3d); +var text3d = null; +var newFont = false; +var newText = false; +if (htForThisFont != null) { +text3d = htForThisFont.get(text); +} else { +htForThisFont = new java.util.Hashtable(); +newFont = true; +}if (text3d == null) { +text3d = new J.g3d.TextRenderer(text, font3d); +newText = true; +}text3d.isInvalid = (text3d.width == 0 || x + text3d.width <= 0 || x >= g3d.width || y + text3d.height <= 0 || y >= g3d.height); +if (text3d.isInvalid) return text3d; +if (newFont) ht.put(font3d, htForThisFont); +if (newText) { +text3d.setTranslucency(text, font3d, g3d); +htForThisFont.put(text, text3d); +}J.g3d.TextRenderer.working = false; +return text3d; +}, "~N,~N,J.g3d.Graphics3D,~S,JU.Font,~B"); +Clazz.defineMethod(c$, "setTranslucency", +function(text, font3d, g3d){ +var pixels = g3d.apiPlatform.getTextPixels(text, font3d, g3d.platform.getGraphicsForTextOrImage(this.mapWidth, this.height), g3d.platform.offscreenImage, this.mapWidth, this.height, this.ascent); +if (pixels == null) return; +this.tmap = Clazz.newByteArray (this.size, 0); +for (var i = pixels.length; --i >= 0; ) { +var p = pixels[i] & 0xFF; +if (p != 0) { +this.tmap[i] = J.g3d.TextRenderer.translucency[p >> 5]; +}} +}, "~S,JU.Font,J.g3d.Graphics3D"); +c$.translucency = Clazz.newByteArray(-1, [7, 6, 5, 4, 3, 2, 1, 8]); +c$.working = false; +c$.htFont3d = new java.util.Hashtable(); +c$.htFont3dAntialias = new java.util.Hashtable(); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/TextString.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/TextString.js new file mode 100755 index 000000000000..97e13368a446 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/TextString.js @@ -0,0 +1,28 @@ +Clazz.declarePackage("J.g3d"); +Clazz.load(["JU.P3i"], "J.g3d.TextString", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.text = null; +this.font = null; +this.argb = 0; +this.bgargb = 0; +Clazz.instantialize(this, arguments);}, J.g3d, "TextString", JU.P3i, java.util.Comparator); +Clazz.defineMethod(c$, "setText", +function(text, font, argb, bgargb, x, y, z){ +this.text = text; +this.font = font; +this.argb = argb; +this.bgargb = bgargb; +this.x = x; +this.y = y; +this.z = z; +}, "~S,JU.Font,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "compare", +function(a, b){ +return (a == null || b == null ? 0 : a.z > b.z ? -1 : a.z < b.z ? 1 : 0); +}, "J.g3d.TextString,J.g3d.TextString"); +Clazz.overrideMethod(c$, "toString", +function(){ +return this.asString() + " " + this.text; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/TriangleRenderer.js b/config/plugins/visualizations/jmol/static/j2s/J/g3d/TriangleRenderer.js new file mode 100755 index 000000000000..856d72a79e9c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/TriangleRenderer.js @@ -0,0 +1,244 @@ +Clazz.declarePackage("J.g3d"); +Clazz.load(["J.g3d.G3DRenderer", "$.PrecisionRenderer", "JU.Rgb16"], "J.g3d.TriangleRenderer", ["JU.GData"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.g3d = null; +this.ax = null; +this.ay = null; +this.az = null; +this.aa = null; +this.bb = null; +this.axW = null; +this.azW = null; +this.axE = null; +this.azE = null; +this.rgb16sW = null; +this.rgb16sE = null; +this.rgb16sGouraud = null; +this.rgb16t1 = null; +this.rgb16t2 = null; +Clazz.instantialize(this, arguments);}, J.g3d, "TriangleRenderer", J.g3d.PrecisionRenderer, J.g3d.G3DRenderer); +Clazz.prepareFields (c$, function(){ +this.ax = Clazz.newIntArray (3, 0); +this.ay = Clazz.newIntArray (3, 0); +this.az = Clazz.newIntArray (3, 0); +this.aa = Clazz.newFloatArray (64, 0); +this.bb = Clazz.newFloatArray (64, 0); +this.axW = Clazz.newIntArray (64, 0); +this.azW = Clazz.newIntArray (64, 0); +this.axE = Clazz.newIntArray (64, 0); +this.azE = Clazz.newIntArray (64, 0); +this.rgb16t1 = new JU.Rgb16(); +this.rgb16t2 = new JU.Rgb16(); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.g3d.TriangleRenderer, []); +}); +Clazz.overrideMethod(c$, "set", +function(g3d, gdata){ +try { +this.rgb16sW = new Array(64); +this.rgb16sE = new Array(64); +for (var i = 64; --i >= 0; ) { +this.rgb16sW[i] = new JU.Rgb16(); +this.rgb16sE[i] = new JU.Rgb16(); +} +this.g3d = g3d; +this.rgb16sGouraud = new Array(3); +for (var i = 3; --i >= 0; ) this.rgb16sGouraud[i] = new JU.Rgb16(); + +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +return this; +}, "J.api.JmolRendererInterface,JU.GData"); +Clazz.defineMethod(c$, "reallocRgb16s", +function(rgb16s, n){ +var t = new Array(n); +System.arraycopy(rgb16s, 0, t, 0, rgb16s.length); +for (var i = rgb16s.length; i < n; ++i) t[i] = new JU.Rgb16(); + +return t; +}, "~A,~N"); +Clazz.defineMethod(c$, "setGouraud", +function(rgbA, rgbB, rgbC){ +this.rgb16sGouraud[0].setInt(rgbA); +this.rgb16sGouraud[1].setInt(rgbB); +this.rgb16sGouraud[2].setInt(rgbC); +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "fillTriangle", +function(screenA, screenB, screenC, useGouraud){ +this.ax[0] = screenA.x; +this.ax[1] = screenB.x; +this.ax[2] = screenC.x; +this.ay[0] = screenA.y; +this.ay[1] = screenB.y; +this.ay[2] = screenC.y; +this.az[0] = screenA.z; +this.az[1] = screenB.z; +this.az[2] = screenC.z; +if (this.az[0] <= 1 || this.az[1] <= 1 || this.az[2] <= 1) return; +var cc0 = this.g3d.clipCode3(this.ax[0], this.ay[0], this.az[0]); +var cc1 = this.g3d.clipCode3(this.ax[1], this.ay[1], this.az[1]); +var cc2 = this.g3d.clipCode3(this.ax[2], this.ay[2], this.az[2]); +var c = (cc0 | cc1 | cc2); +var isClipped = (c != 0); +if (isClipped) { +if (c == -1 || (cc0 & cc1 & cc2) != 0) { +return; +}}var iMinY = 0; +if (this.ay[1] < this.ay[iMinY]) iMinY = 1; +if (this.ay[2] < this.ay[iMinY]) iMinY = 2; +var iMidY = (iMinY + 1) % 3; +var iMaxY = (iMinY + 2) % 3; +if (this.ay[iMidY] > this.ay[iMaxY]) { +var t = iMidY; +iMidY = iMaxY; +iMaxY = t; +}var yMin = this.ay[iMinY]; +var yMid = this.ay[iMidY]; +var yMax = this.ay[iMaxY]; +var nLines = yMax - yMin + 1; +if (nLines > this.g3d.height * 3) return; +if (nLines > this.axW.length) { +var n = (nLines + 31) & -32; +this.axW = Clazz.newIntArray (n, 0); +this.azW = Clazz.newIntArray (n, 0); +this.axE = Clazz.newIntArray (n, 0); +this.azE = Clazz.newIntArray (n, 0); +this.aa = Clazz.newFloatArray (n, 0); +this.bb = Clazz.newFloatArray (n, 0); +this.rgb16sW = this.reallocRgb16s(this.rgb16sW, n); +this.rgb16sE = this.reallocRgb16s(this.rgb16sE, n); +}var gouraudW; +var gouraudE; +if (useGouraud) { +gouraudW = this.rgb16sW; +gouraudE = this.rgb16sE; +} else { +gouraudW = gouraudE = null; +}var dyMidMin = yMid - yMin; +if (dyMidMin == 0) { +if (this.ax[iMidY] < this.ax[iMinY]) { +var t = iMidY; +iMidY = iMinY; +iMinY = t; +}this.generateRaster(nLines, iMinY, iMaxY, this.axW, this.azW, 0, gouraudW); +this.generateRaster(nLines, iMidY, iMaxY, this.axE, this.azE, 0, gouraudE); +} else if (yMid == yMax) { +if (this.ax[iMaxY] < this.ax[iMidY]) { +var t = iMidY; +iMidY = iMaxY; +iMaxY = t; +}this.generateRaster(nLines, iMinY, iMidY, this.axW, this.azW, 0, gouraudW); +this.generateRaster(nLines, iMinY, iMaxY, this.axE, this.azE, 0, gouraudE); +} else { +var dxMaxMin = this.ax[iMaxY] - this.ax[iMinY]; +var roundFactor; +roundFactor = JU.GData.roundInt(Clazz.doubleToInt(nLines / 2)); +if (dxMaxMin < 0) roundFactor = -roundFactor; +var axSplit = this.ax[iMinY] + Clazz.doubleToInt((dxMaxMin * dyMidMin + roundFactor) / nLines); +if (axSplit < this.ax[iMidY]) { +this.generateRaster(nLines, iMinY, iMaxY, this.axW, this.azW, 0, gouraudW); +this.generateRaster(dyMidMin + 1, iMinY, iMidY, this.axE, this.azE, 0, gouraudE); +this.generateRaster(nLines - dyMidMin, iMidY, iMaxY, this.axE, this.azE, dyMidMin, gouraudE); +} else { +this.generateRaster(dyMidMin + 1, iMinY, iMidY, this.axW, this.azW, 0, gouraudW); +this.generateRaster(nLines - dyMidMin, iMidY, iMaxY, this.axW, this.azW, dyMidMin, gouraudW); +this.generateRaster(nLines, iMinY, iMaxY, this.axE, this.azE, 0, gouraudE); +}}this.g3d.setZMargin(5); +var pass2Row = this.g3d.pass2Flag01; +var pass2Off = 1 - pass2Row; +var xW; +var i = 0; +if (yMin < 0) { +nLines += yMin; +i -= yMin; +yMin = 0; +}if (yMin + nLines > this.g3d.height) nLines = this.g3d.height - yMin; +if (useGouraud) { +if (isClipped) { +for (; --nLines >= pass2Row; ++yMin, ++i) { +var pixelCount = this.axE[i] - (xW = this.axW[i]) + pass2Off; +if (pixelCount > 0) this.g3d.plotPixelsClippedRaster(pixelCount, xW, yMin, this.azW[i], this.azE[i], this.rgb16sW[i], this.rgb16sE[i]); +} +} else { +for (; --nLines >= pass2Row; ++yMin, ++i) { +var pixelCount = this.axE[i] - (xW = this.axW[i]) + pass2Off; +if (pass2Row == 1 && pixelCount < 0) { +pixelCount = 1; +xW--; +}if (pixelCount > 0) this.g3d.plotPixelsUnclippedRaster(pixelCount, xW, yMin, this.azW[i], this.azE[i], this.rgb16sW[i], this.rgb16sE[i]); +} +}} else { +if (isClipped) { +for (; --nLines >= pass2Row; ++yMin, ++i) { +var pixelCount = this.axE[i] - (xW = this.axW[i]) + pass2Off; +if (pixelCount > 0) this.g3d.plotPixelsClippedRasterBits(pixelCount, xW, yMin, this.azW[i], this.azE[i], null, null, this.aa[i], this.bb[i]); +} +} else { +for (; --nLines >= pass2Row; ++yMin, ++i) { +var pixelCount = this.axE[i] - (xW = this.axW[i]) + pass2Off; +if (pass2Row == 1 && pixelCount < 0) { +pixelCount = 1; +xW--; +}if (pixelCount > 0) this.g3d.plotPixelsUnclippedRasterBits(pixelCount, xW, yMin, null, null, this.aa[i], this.bb[i]); +} +}}this.g3d.setZMargin(0); +}, "JU.P3i,JU.P3i,JU.P3i,~B"); +Clazz.defineMethod(c$, "generateRaster", +function(dy, iN, iS, axRaster, azRaster, iRaster, gouraud){ +var xN = this.ax[iN]; +var xS = this.ax[iS]; +var dx = xS - xN; +var xCurrent = xN; +var xIncrement; +var width; +var errorTerm; +if (dx >= 0) { +xIncrement = 1; +width = dx; +errorTerm = 0; +} else { +xIncrement = -1; +width = -dx; +errorTerm = 1 - dy; +}var xMajorIncrement; +var xMajorError; +if (width <= dy) { +xMajorIncrement = 0; +xMajorError = width; +} else { +xMajorIncrement = JU.GData.roundInt(Clazz.doubleToInt(dx / dy)); +xMajorError = width % dy; +}this.setRastAB(this.ay[iN], this.az[iN], this.ay[iS], this.az[iS]); +var a0 = this.a; +var b0 = this.b; +var isEast = (axRaster === this.axE); +for (var y = 0, zy = this.ay[iN], lastY = dy - 1, i = iRaster; y <= lastY; ++i, ++y, ++zy) { +if (i == 0 || i > iRaster) { +axRaster[i] = (y == lastY ? this.ax[iS] : xCurrent); +azRaster[i] = this.getZCurrent(a0, b0, zy); +if (isEast) { +this.setRastAB(this.axW[i], this.azW[i], axRaster[i], azRaster[i]); +this.aa[i] = this.a; +this.bb[i] = this.b; +}}xCurrent += xMajorIncrement; +errorTerm += xMajorError; +if (errorTerm > 0) { +xCurrent += xIncrement; +errorTerm -= dy; +}} +if (gouraud != null) { +var rgb16Base = this.rgb16t1; +rgb16Base.setRgb(this.rgb16sGouraud[iN]); +var rgb16Increment = this.rgb16t2; +rgb16Increment.diffDiv(this.rgb16sGouraud[iS], rgb16Base, dy); +for (var i = iRaster, iMax = iRaster + dy; i < iMax; ++i) gouraud[i].setAndIncrement(rgb16Base, rgb16Increment); + +}}, "~N,~N,~N,~A,~A,~N,~A"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/g3d/package.html b/config/plugins/visualizations/jmol/static/j2s/J/g3d/package.html new file mode 100755 index 000000000000..dd367deda1a7 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/g3d/package.html @@ -0,0 +1,61 @@ + + + + + + + ++ Provides a software implementation of complete 3D graphics engine + for rendering molecules and associated shapes. + basic shapes. +
++ This package implements all graphics primitives used by Jmol. The + graphics engine does not use Java3D or OpenGL. It requires no specialized + graphics hardware. This allows Jmol and the JmolApplet to run on any + machine that has a JVM. +
++ It is a software implementation of a graphics z-buffer. An int[] called + pbuf (for pixel buffer) is used to hold ARGB values for pixels. A short[] + called zbuf holds the z-depth value. +
++ Shape primitives are provided for drawing spheres, cylinders, triangles, etc. + Shading primitives provide lighting/shading support +
+ +Related Documentation
+ + Makes use of javax.vecmath classes. + + + + + diff --git a/config/plugins/visualizations/jmol/static/j2s/J/geodesic/EnvelopeCalculation.js b/config/plugins/visualizations/jmol/static/j2s/J/geodesic/EnvelopeCalculation.js new file mode 100755 index 000000000000..1952b2cdd9da --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/geodesic/EnvelopeCalculation.js @@ -0,0 +1,359 @@ +Clazz.declarePackage("J.geodesic"); +Clazz.load(["J.api.JmolEnvCalc", "JU.P3", "J.atomdata.AtomData"], "J.geodesic.EnvelopeCalculation", ["JU.AU", "$.BS", "$.V3", "J.atomdata.RadiusData", "JU.BSUtil", "$.Geodesic", "$.Normix"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.geodesicMap = null; +this.mapT = null; +this.mads = null; +this.atomData = null; +this.vwr = null; +this.ac = 0; +this.maxRadius = 0; +this.modelZeroBased = false; +this.disregardNeighbors = false; +this.bsMySelected = null; +this.dotsConvexMaps = null; +this.dotsConvexMax = 0; +this.geodesicCount = 0; +this.bsSurface = null; +this.radiusP = 0; +this.diameterP = 0; +this.bsTemp = null; +this.bsIgnore = null; +this.onlySelectedDots = false; +this.isSurface = false; +this.multiModel = false; +this.currentPoints = null; +this.indexI = 0; +this.centerI = null; +this.radiusI = 0; +this.radiiIP2 = 0; +this.pointT = null; +this.centerT = null; +this.vertexTest = null; +this.neighborCount = 0; +this.neighborIndices = null; +this.neighborCenters = null; +this.neighborPlusProbeRadii2 = null; +this.neighborRadii2 = null; +Clazz.instantialize(this, arguments);}, J.geodesic, "EnvelopeCalculation", null, J.api.JmolEnvCalc); +Clazz.prepareFields (c$, function(){ +this.atomData = new J.atomdata.AtomData(); +this.pointT = new JU.P3(); +this.vertexTest = new Array(12); +{ +for (var i = 0; i < 12; i++) this.vertexTest[i] = new JU.P3(); + +}this.neighborIndices = Clazz.newIntArray (16, 0); +this.neighborCenters = new Array(16); +this.neighborPlusProbeRadii2 = Clazz.newFloatArray (16, 0); +this.neighborRadii2 = Clazz.newFloatArray (16, 0); +}); +Clazz.makeConstructor(c$, +function(){ +}); +Clazz.overrideMethod(c$, "set", +function(vwr, ac, mads){ +this.vwr = vwr; +this.ac = ac; +this.mads = mads; +this.geodesicCount = JU.Geodesic.getVertexCount(3); +this.geodesicMap = JU.BS.newN(this.geodesicCount); +this.mapT = JU.BS.newN(this.geodesicCount); +J.geodesic.EnvelopeCalculation.EMPTY_SET = JU.BSUtil.emptySet; +return this; +}, "J.atomdata.AtomDataServer,~N,~A"); +Clazz.defineMethod(c$, "getDotsConvexMaps", +function(){ +return this.dotsConvexMaps; +}); +Clazz.defineMethod(c$, "getDotsConvexMax", +function(){ +return this.dotsConvexMax; +}); +Clazz.defineMethod(c$, "allocDotsConvexMaps", +function(max){ +if (this.dotsConvexMax >= max) return; +this.dotsConvexMax = max; +this.dotsConvexMaps = new Array(max); +}, "~N"); +Clazz.overrideMethod(c$, "getBsSurfaceClone", +function(){ +return JU.BSUtil.copy(this.bsSurface); +}); +Clazz.defineMethod(c$, "setMads", +function(mads){ +this.mads = mads; +}, "~A"); +Clazz.defineMethod(c$, "setFromBits", +function(index, bs){ +this.geodesicMap.setBits(0, this.geodesicCount); +for (var iDot = this.geodesicCount; --iDot >= 0; ) if (!bs.get(iDot)) this.geodesicMap.clear(iDot); + +if (this.dotsConvexMaps == null) this.dotsConvexMaps = new Array(this.ac); +var map; +if (this.geodesicMap.isEmpty()) map = J.geodesic.EnvelopeCalculation.EMPTY_SET; + else map = JU.BSUtil.copy(this.geodesicMap); +if (index >= this.dotsConvexMaps.length) return; +this.dotsConvexMaps[index] = map; +this.dotsConvexMax = Math.max(this.dotsConvexMax, index); +}, "~N,JU.BS"); +Clazz.defineMethod(c$, "newSet", +function(){ +this.dotsConvexMax = 0; +this.dotsConvexMaps = null; +this.radiusP = this.diameterP = 0; +this.mads = null; +}); +Clazz.defineMethod(c$, "reCalculate", +function(bs, m){ +if (this.atomData.radiusData != null) { +this.calculate(null, this.maxRadius, bs, this.bsIgnore, this.disregardNeighbors, this.onlySelectedDots, this.isSurface, this.multiModel); +return; +}if (this.dotsConvexMaps == null || this.dotsConvexMax == 0) return; +var pt = new JU.V3(); +if (this.bsTemp == null) this.bsTemp = JU.Normix.newVertexBitSet(); +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { +if (i >= this.dotsConvexMax) return; +var map = this.dotsConvexMaps[i]; +if (map == null || map.isEmpty()) continue; +var bsNew = new JU.BS(); +for (var j = map.nextSetBit(0); j >= 0; j = map.nextSetBit(j + 1)) { +pt.setT(JU.Geodesic.getVertexVector(j)); +m.rotate(pt); +bsNew.set(JU.Normix.getNormixV(pt, this.bsTemp)); +} +this.dotsConvexMaps[i] = bsNew; +} +}, "JU.BS,JU.M3"); +Clazz.overrideMethod(c$, "calculate", +function(rd, maxRadius, bsSelected, bsIgnore, disregardNeighbors, onlySelectedDots, isSurface, multiModel){ +if (rd == null) { +rd = this.atomData.radiusData; +if (rd == null) return; +} else { +this.atomData.radiusData = rd; +this.bsIgnore = bsIgnore; +this.onlySelectedDots = onlySelectedDots; +this.multiModel = multiModel; +this.isSurface = isSurface; +}if (rd.value == 3.4028235E38) rd.value = 3.0; +this.atomData.modelIndex = (multiModel ? -1 : 0); +this.modelZeroBased = !multiModel; +this.vwr.fillAtomData(this.atomData, 1 | (this.mads == null ? 2 : 0)); +this.ac = this.atomData.ac; +if (this.mads != null) for (var i = 0; i < this.ac; i++) this.atomData.atomRadius[i] = this.mads[i] / 1000; + +this.bsMySelected = (onlySelectedDots && bsSelected != null ? JU.BSUtil.copy(bsSelected) : bsIgnore != null ? JU.BSUtil.setAll(this.ac) : null); +JU.BSUtil.andNot(this.bsMySelected, bsIgnore); +this.disregardNeighbors = disregardNeighbors; +this.maxRadius = maxRadius; +this.bsSurface = new JU.BS(); +var isAll = (bsSelected == null); +var iter = this.vwr.getSelectedAtomIterator(this.bsMySelected, false, this.modelZeroBased, false); +this.checkNewDotsArray(); +var i0 = (isAll ? this.ac - 1 : bsSelected.nextSetBit(0)); +for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsSelected.nextSetBit(i + 1))) if (bsIgnore == null || !bsIgnore.get(i)) { +this.setAtomI(i); +this.getNeighbors(iter); +this.calcConvexMap(isSurface); +} +iter.release(); +this.currentPoints = null; +this.setDotsConvexMax(); +}, "J.atomdata.RadiusData,~N,JU.BS,JU.BS,~B,~B,~B,~B"); +Clazz.defineMethod(c$, "getRadius", +function(atomIndex){ +return this.atomData.atomRadius[atomIndex]; +}, "~N"); +Clazz.overrideMethod(c$, "getPoints", +function(){ +if (this.dotsConvexMaps == null) { +this.calculate( new J.atomdata.RadiusData(null, 3.0, J.atomdata.RadiusData.EnumType.ABSOLUTE, null), 3.4028235E38, this.bsMySelected, null, false, false, false, false); +}if (this.currentPoints != null) return this.currentPoints; +var nPoints = 0; +var dotCount = 42; +for (var i = this.dotsConvexMax; --i >= 0; ) if (this.dotsConvexMaps[i] != null) nPoints += this.dotsConvexMaps[i].cardinalityN(dotCount); + +var points = new Array(nPoints); +if (nPoints == 0) return points; +nPoints = 0; +for (var i = this.dotsConvexMax; --i >= 0; ) if (this.dotsConvexMaps[i] != null) { +var iDot = this.dotsConvexMaps[i].size(); +if (iDot > dotCount) iDot = dotCount; +while (--iDot >= 0) if (this.dotsConvexMaps[i].get(iDot)) { +var pt = new JU.P3(); +pt.scaleAdd2(this.atomData.atomRadius[i], JU.Geodesic.getVertexVector(iDot), this.atomData.xyz[i]); +points[nPoints++] = pt; +} +} +this.currentPoints = points; +return points; +}); +Clazz.defineMethod(c$, "setDotsConvexMax", +function(){ +if (this.dotsConvexMaps == null) this.dotsConvexMax = 0; + else { +var i; +for (i = this.ac; --i >= 0 && this.dotsConvexMaps[i] == null; ) { +} +this.dotsConvexMax = i + 1; +}}); +Clazz.defineMethod(c$, "getAppropriateRadius", +function(atomIndex){ +return (this.mads != null ? (atomIndex >= this.mads.length ? 0 : this.mads[atomIndex] / 1000) : this.atomData.atomRadius[atomIndex]); +}, "~N"); +Clazz.defineMethod(c$, "setAtomI", +function(indexI){ +this.indexI = indexI; +this.centerI = this.atomData.xyz[indexI]; +this.radiusI = this.atomData.atomRadius[indexI]; +this.radiiIP2 = this.radiusI + this.radiusP; +this.radiiIP2 *= this.radiiIP2; +}, "~N"); +Clazz.defineMethod(c$, "calcConvexMap", +function(isSurface){ +this.calcConvexBits(); +var map; +if (this.geodesicMap.isEmpty()) map = J.geodesic.EnvelopeCalculation.EMPTY_SET; + else { +this.bsSurface.set(this.indexI); +if (isSurface) { +this.addIncompleteFaces(this.geodesicMap); +this.addIncompleteFaces(this.geodesicMap); +}map = JU.BSUtil.copy(this.geodesicMap); +}this.dotsConvexMaps[this.indexI] = map; +}, "~B"); +Clazz.defineMethod(c$, "addIncompleteFaces", +function(points){ +this.mapT.clearAll(); +var faces = JU.Geodesic.getFaceVertexes(3); +var len = faces.length; +var maxPt = -1; +for (var f = 0; f < len; ) { +var p1 = faces[f++]; +var p2 = faces[f++]; +var p3 = faces[f++]; +var ok1 = points.get(p1); +var ok2 = points.get(p2); +var ok3 = points.get(p3); +if (!(ok1 || ok2 || ok3) || ok1 && ok2 && ok3) continue; +if (!ok1) { +this.mapT.set(p1); +if (maxPt < p1) maxPt = p1; +}if (!ok2) { +this.mapT.set(p2); +if (maxPt < p2) maxPt = p2; +}if (!ok3) { +this.mapT.set(p3); +if (maxPt < p3) maxPt = p3; +}} +for (var i = 0; i <= maxPt; i++) { +if (this.mapT.get(i)) points.set(i); +} +}, "JU.BS"); +Clazz.defineMethod(c$, "calcConvexBits", +function(){ +this.geodesicMap.setBits(0, this.geodesicCount); +var combinedRadii = this.radiusI + this.radiusP; +if (this.neighborCount == 0) return; +var faceTest; +var p1; +var p2; +var p3; +var faces = JU.Geodesic.getFaceVertexes(3); +var p4 = J.geodesic.EnvelopeCalculation.power4[2]; +var ok1; +var ok2; +var ok3; +this.mapT.clearAll(); +for (var i = 0; i < 12; i++) { +this.vertexTest[i].scaleAdd2(combinedRadii, JU.Geodesic.getVertexVector(i), this.centerI); +} +for (var f = 0; f < 20; f++) { +faceTest = 0; +p1 = faces[3 * p4 * (4 * f + 0)]; +p2 = faces[3 * p4 * (4 * f + 1)]; +p3 = faces[3 * p4 * (4 * f + 2)]; +for (var j = 0; j < this.neighborCount; j++) { +var maxDist = this.neighborPlusProbeRadii2[j]; +this.centerT = this.neighborCenters[j]; +ok1 = this.vertexTest[p1].distanceSquared(this.centerT) >= maxDist; +ok2 = this.vertexTest[p2].distanceSquared(this.centerT) >= maxDist; +ok3 = this.vertexTest[p3].distanceSquared(this.centerT) >= maxDist; +if (!ok1) this.geodesicMap.clear(p1); +if (!ok2) this.geodesicMap.clear(p2); +if (!ok3) this.geodesicMap.clear(p3); +if (!ok1 && !ok2 && !ok3) { +faceTest = -1; +break; +}} +var kFirst = f * 12 * p4; +var kLast = kFirst + 12 * p4; +for (var k = kFirst; k < kLast; k++) { +var vect = faces[k]; +if (this.mapT.get(vect) || !this.geodesicMap.get(vect)) continue; +switch (faceTest) { +case -1: +this.geodesicMap.clear(vect); +break; +case 0: +for (var j = 0; j < this.neighborCount; j++) { +var maxDist = this.neighborPlusProbeRadii2[j]; +this.centerT = this.neighborCenters[j]; +this.pointT.scaleAdd2(combinedRadii, JU.Geodesic.getVertexVector(vect), this.centerI); +if (this.pointT.distanceSquared(this.centerT) < maxDist) this.geodesicMap.clear(vect); +} +break; +case 1: +} +this.mapT.set(vect); +} +} +}); +Clazz.defineMethod(c$, "checkNewDotsArray", +function(){ +if (this.dotsConvexMaps == null) { +this.dotsConvexMaps = new Array(this.ac); +} else if (this.dotsConvexMaps.length != this.ac) { +var a = new Array(this.ac); +for (var i = 0; i < this.ac && i < this.dotsConvexMaps.length; i++) a[i] = this.dotsConvexMaps[i]; + +this.dotsConvexMaps = a; +}}); +Clazz.defineMethod(c$, "getNeighbors", +function(iter){ +this.neighborCount = 0; +if (this.disregardNeighbors) return null; +this.vwr.setIteratorForAtom(iter, this.indexI, this.radiusI + this.diameterP + this.maxRadius); +while (iter.hasNext()) { +var indexN = iter.next(); +var neighborRadius = this.atomData.atomRadius[indexN]; +if (this.centerI.distance(this.atomData.xyz[indexN]) > this.radiusI + this.radiusP + this.radiusP + neighborRadius) continue; +if (this.neighborCount == this.neighborIndices.length) { +this.neighborIndices = JU.AU.doubleLengthI(this.neighborIndices); +this.neighborCenters = JU.AU.doubleLength(this.neighborCenters); +this.neighborPlusProbeRadii2 = JU.AU.doubleLengthF(this.neighborPlusProbeRadii2); +this.neighborRadii2 = JU.AU.doubleLengthF(this.neighborRadii2); +}this.neighborCenters[this.neighborCount] = this.atomData.xyz[indexN]; +this.neighborIndices[this.neighborCount] = indexN; +var r = neighborRadius + this.radiusP; +this.neighborPlusProbeRadii2[this.neighborCount] = r * r; +this.neighborRadii2[this.neighborCount] = neighborRadius * neighborRadius; +++this.neighborCount; +} +return iter; +}, "J.api.AtomIndexIterator"); +Clazz.defineMethod(c$, "deleteAtoms", +function(firstAtomDeleted, nAtomsDeleted){ +this.dotsConvexMaps = JU.AU.deleteElements(this.dotsConvexMaps, firstAtomDeleted, nAtomsDeleted); +this.dotsConvexMax = this.dotsConvexMaps.length; +if (this.mads != null) this.mads = JU.AU.deleteElements(this.mads, firstAtomDeleted, nAtomsDeleted); +this.atomData.atomRadius = JU.AU.deleteElements(this.atomData.atomRadius, firstAtomDeleted, nAtomsDeleted); +this.atomData.xyz = JU.AU.deleteElements(this.atomData.xyz, firstAtomDeleted, nAtomsDeleted); +this.atomData.ac -= nAtomsDeleted; +this.ac = this.atomData.ac; +}, "~N,~N"); +c$.EMPTY_SET = null; +c$.power4 = Clazz.newIntArray(-1, [1, 4, 16, 64, 256]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/i18n/GT.js b/config/plugins/visualizations/jmol/static/j2s/J/i18n/GT.js new file mode 100755 index 000000000000..f5a47063edd8 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/i18n/GT.js @@ -0,0 +1,186 @@ +Clazz.declarePackage("J.i18n"); +Clazz.load(["J.api.Translator", "java.text.MessageFormat", "java.util.Hashtable", "JU.PT", "J.i18n.Language", "$.Resource"], "J.i18n.GT", ["JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.resources = null; +this.resourceCount = 0; +this.doTranslate = true; +this.language = null; +Clazz.instantialize(this, arguments);}, J.i18n, "GT", null, J.api.Translator); +/*LV!1824 unnec constructor*/Clazz.makeConstructor(c$, +function(vr, langCode){ +{ +}this.resources = null; +this.resourceCount = 0; +J.i18n.GT.$getTextWrapper = this; +if (langCode != null && langCode.length == 0) langCode = "none"; +if (langCode != null) this.language = langCode; +if ("none".equals(this.language)) this.language = null; +if (this.language == null) this.language = J.i18n.Resource.getLanguage(); +if (this.language == null) this.language = "en"; +var la = this.language; +var la_co = null; +var la_co_va = null; +var i = this.language.indexOf("_"); +if (i >= 0) { +la = la.substring(0, i); +la_co = this.language; +if ((i = la_co.indexOf("_", ++i)) >= 0) { +la_co = la_co.substring(0, i); +la_co_va = this.language; +}}if ((this.language = this.getSupported(la_co_va)) == null && (this.language = this.getSupported(la_co)) == null && (this.language = this.getSupported(la)) == null) { +this.language = "en"; +System.out.println(this.language + " not supported -- using en"); +return; +}la_co_va = null; +la_co = null; +switch (this.language.length) { +default: +la_co_va = this.language; +la_co = this.language.substring(0, 5); +la = this.language.substring(0, 2); +break; +case 5: +la_co = this.language; +la = this.language.substring(0, 2); +break; +case 2: +la = this.language; +break; +} +la_co = this.getSupported(la_co); +la = this.getSupported(la); +if (la === la_co || "en_US".equals(la)) la = null; +if (la_co === la_co_va) la_co = null; +if ("en_US".equals(la_co)) return; +if (J.i18n.GT.allowDebug && JU.Logger.debugging) JU.Logger.debug("Instantiating gettext wrapper for " + this.language + " using files for language:" + la + " country:" + la_co + " variant:" + la_co_va); +if (!J.i18n.GT.$ignoreApplicationBundle) this.addBundles(vr, "Jmol", la_co_va, null, null); +this.addBundles(vr, "JmolApplet", la_co_va, null, null); +if (!J.i18n.GT.$ignoreApplicationBundle) this.addBundles(vr, "Jmol", null, la_co, null); +this.addBundles(vr, "JmolApplet", null, la_co, null); +if (!J.i18n.GT.$ignoreApplicationBundle) this.addBundles(vr, "Jmol", null, null, la); +this.addBundles(vr, "JmolApplet", null, null, la); +}, "JV.Viewer,~S"); +Clazz.overrideMethod(c$, "translate", +function(s){ +return J.i18n.GT.$(s); +}, "~S"); +c$.getLanguageList = Clazz.defineMethod(c$, "getLanguageList", +function(gt){ +if (J.i18n.GT.languageList == null) { +if (gt == null) gt = J.i18n.GT.getTextWrapper(); +gt.createLanguageList(); +}return J.i18n.GT.languageList; +}, "J.i18n.GT"); +c$.getLanguage = Clazz.defineMethod(c$, "getLanguage", +function(){ +return J.i18n.GT.getTextWrapper().language; +}); +c$.ignoreApplicationBundle = Clazz.defineMethod(c$, "ignoreApplicationBundle", +function(){ +J.i18n.GT.$ignoreApplicationBundle = true; +}); +c$.setDoTranslate = Clazz.defineMethod(c$, "setDoTranslate", +function(TF){ +var b = J.i18n.GT.getDoTranslate(); +J.i18n.GT.getTextWrapper().doTranslate = TF; +return b; +}, "~B"); +c$.getDoTranslate = Clazz.defineMethod(c$, "getDoTranslate", +function(){ +return J.i18n.GT.getTextWrapper().doTranslate; +}); +c$.$ = Clazz.defineMethod(c$, "$", +function(string){ +return J.i18n.GT.getTextWrapper().getString(string); +}, "~S"); +c$.o = Clazz.defineMethod(c$, "o", +function(s, o){ +if (Clazz.instanceOf(o,Array)) { +if ((o).length != 1) return java.text.MessageFormat.format(s, o); +o = (o)[0]; +}return JU.PT.rep(s, "{0}", o.toString()); +}, "~S,~O"); +c$.i = Clazz.defineMethod(c$, "i", +function(s, n){ +return JU.PT.rep(s, "{0}", "" + n); +}, "~S,~N"); +c$.escapeHTML = Clazz.defineMethod(c$, "escapeHTML", +function(msg){ +var ch; +for (var i = msg.length; --i >= 0; ) if ((ch = msg.charAt(i)).charCodeAt(0) > 0x7F) { +msg = msg.substring(0, i) + "" + ((ch).charCodeAt(0)) + ";" + msg.substring(i + 1); +} +return msg; +}, "~S"); +c$.getTextWrapper = Clazz.defineMethod(c$, "getTextWrapper", +function(){ +return (J.i18n.GT.$getTextWrapper == null ? J.i18n.GT.$getTextWrapper = new J.i18n.GT(null, null) : J.i18n.GT.$getTextWrapper); +}); +Clazz.defineMethod(c$, "createLanguageList", +function(){ +var wasTranslating = this.doTranslate; +this.doTranslate = false; +J.i18n.GT.languageList = J.i18n.Language.getLanguageList(); +this.doTranslate = wasTranslating; +}); +Clazz.defineMethod(c$, "getSupported", +function(code){ +if (code == null) return null; +var s = J.i18n.GT.htLanguages.get(code); +if (s != null) return (s.length == 0 ? null : s); +s = J.i18n.Language.getSupported(J.i18n.GT.getLanguageList(this), code); +J.i18n.GT.htLanguages.put(code, (s == null ? "" : s)); +return s; +}, "~S"); +Clazz.defineMethod(c$, "addBundles", +function(vwr, type, la_co_va, la_co, la){ +try { +var className = "J.translation." + type + "."; +if (la_co_va != null) this.addBundle(vwr, className, la_co_va); +if (la_co != null) this.addBundle(vwr, className, la_co); +if (la != null) this.addBundle(vwr, className, la); +} catch (exception) { +if (Clazz.exceptionOf(exception, Exception)){ +if (J.i18n.GT.allowDebug) JU.Logger.errorEx("Some exception occurred!", exception); +this.resources = null; +this.resourceCount = 0; +} else { +throw exception; +} +} +}, "JV.Viewer,~S,~S,~S,~S"); +Clazz.defineMethod(c$, "addBundle", +function(vwr, className, name){ +var resource = J.i18n.Resource.getResource(vwr, className, name); +if (resource != null) { +if (this.resources == null) { +this.resources = new Array(8); +this.resourceCount = 0; +}this.resources[this.resourceCount] = resource; +this.resourceCount++; +if (J.i18n.GT.allowDebug) JU.Logger.debug("GT adding " + className); +}}, "JV.Viewer,~S,~S"); +Clazz.defineMethod(c$, "getString", +function(s){ +var trans = null; +if (this.doTranslate) { +for (var bundle = 0; bundle < this.resourceCount; bundle++) { +trans = this.resources[bundle].getString(s); +if (trans != null) { +s = trans; +break; +}} +if (this.resourceCount > 0 && trans == null && J.i18n.GT.allowDebug && JU.Logger.debugging) JU.Logger.debug("No trans, using default: " + s); +}if (trans == null) { +if (s.startsWith("[")) s = s.substring(s.indexOf("]") + 1); + else if (s.endsWith("]")) s = s.substring(0, s.indexOf("[")); +}return s; +}, "~S"); +c$.$ignoreApplicationBundle = false; +c$.$getTextWrapper = null; +c$.languageList = null; +c$.allowDebug = false; +c$.vwr = null; +c$.htLanguages = new java.util.Hashtable(); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/i18n/Language.js b/config/plugins/visualizations/jmol/static/j2s/J/i18n/Language.js new file mode 100755 index 000000000000..45640dcbe94c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/i18n/Language.js @@ -0,0 +1,29 @@ +Clazz.declarePackage("J.i18n"); +Clazz.load(null, "J.i18n.Language", ["J.i18n.GT"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.code = null; +this.language = null; +this.nativeLanguage = null; +this.display = false; +Clazz.instantialize(this, arguments);}, J.i18n, "Language", null); +Clazz.makeConstructor(c$, +function(code, language, nativeLanguage, display){ +this.code = code; +this.language = language; +this.nativeLanguage = nativeLanguage; +this.display = display; +}, "~S,~S,~S,~B"); +c$.getLanguageList = Clazz.defineMethod(c$, "getLanguageList", +function(){ +return Clazz.newArray(-1, [ new J.i18n.Language("ar", J.i18n.GT.$("Arabic"), "العربية", false), new J.i18n.Language("ast", J.i18n.GT.$("Asturian"), "Asturian", false), new J.i18n.Language("az", J.i18n.GT.$("Azerbaijani"), "azÉ™rbaycan dili", false), new J.i18n.Language("bs", J.i18n.GT.$("Bosnian"), "bosanski jezik", false), new J.i18n.Language("ca", J.i18n.GT.$("Catalan"), "Català ", true), new J.i18n.Language("cs", J.i18n.GT.$("Czech"), "ÄŒeÅ¡tina", true), new J.i18n.Language("da", J.i18n.GT.$("Danish"), "Dansk", true), new J.i18n.Language("de", J.i18n.GT.$("German"), "Deutsch", true), new J.i18n.Language("el", J.i18n.GT.$("Greek"), "Ελληνικά", false), new J.i18n.Language("en_AU", J.i18n.GT.$("Australian English"), "Australian English", false), new J.i18n.Language("en_GB", J.i18n.GT.$("British English"), "British English", true), new J.i18n.Language("en_US", J.i18n.GT.$("American English"), "American English", true), new J.i18n.Language("es", J.i18n.GT.$("Spanish"), "Español", true), new J.i18n.Language("et", J.i18n.GT.$("Estonian"), "Eesti", false), new J.i18n.Language("eu", J.i18n.GT.$("Basque"), "Euskara", true), new J.i18n.Language("fi", J.i18n.GT.$("Finnish"), "Suomi", true), new J.i18n.Language("fo", J.i18n.GT.$("Faroese"), "Føroyskt", false), new J.i18n.Language("fr", J.i18n.GT.$("French"), "Français", true), new J.i18n.Language("fy", J.i18n.GT.$("Frisian"), "Frysk", false), new J.i18n.Language("gl", J.i18n.GT.$("Galician"), "Galego", false), new J.i18n.Language("hr", J.i18n.GT.$("Croatian"), "Hrvatski", false), new J.i18n.Language("hu", J.i18n.GT.$("Hungarian"), "Magyar", true), new J.i18n.Language("hy", J.i18n.GT.$("Armenian"), "Õ€Õ¡ÕµÕ¥Ö€Õ¥Õ¶", false), new J.i18n.Language("id", J.i18n.GT.$("Indonesian"), "Indonesia", true), new J.i18n.Language("it", J.i18n.GT.$("Italian"), "Italiano", true), new J.i18n.Language("ja", J.i18n.GT.$("Japanese"), "日本語", true), new J.i18n.Language("jv", J.i18n.GT.$("Javanese"), "Basa Jawa", false), new J.i18n.Language("ko", J.i18n.GT.$("Korean"), "í•œêµì–´", true), new J.i18n.Language("ms", J.i18n.GT.$("Malay"), "Bahasa Melayu", true), new J.i18n.Language("nb", J.i18n.GT.$("Norwegian Bokmal"), "Norsk BokmÃ¥l", false), new J.i18n.Language("nl", J.i18n.GT.$("Dutch"), "Nederlands", true), new J.i18n.Language("oc", J.i18n.GT.$("Occitan"), "Occitan", false), new J.i18n.Language("pl", J.i18n.GT.$("Polish"), "Polski", false), new J.i18n.Language("pt", J.i18n.GT.$("Portuguese"), "Português", false), new J.i18n.Language("pt_BR", J.i18n.GT.$("Brazilian Portuguese"), "Português brasileiro", true), new J.i18n.Language("ru", J.i18n.GT.$("Russian"), "РуÑÑкий", true), new J.i18n.Language("sl", J.i18n.GT.$("Slovenian"), "SlovenÅ¡Äina", false), new J.i18n.Language("sr", J.i18n.GT.$("Serbian"), "ÑрпÑки језик", false), new J.i18n.Language("sv", J.i18n.GT.$("Swedish"), "Svenska", true), new J.i18n.Language("ta", J.i18n.GT.$("Tamil"), "தமிழà¯", false), new J.i18n.Language("te", J.i18n.GT.$("Telugu"), "తెలà±à°—à±", false), new J.i18n.Language("tr", J.i18n.GT.$("Turkish"), "Türkçe", true), new J.i18n.Language("ug", J.i18n.GT.$("Uyghur"), "UyÆ£urqÉ™", false), new J.i18n.Language("uk", J.i18n.GT.$("Ukrainian"), "УкраїнÑька", true), new J.i18n.Language("uz", J.i18n.GT.$("Uzbek"), "O'zbek", false), new J.i18n.Language("zh_CN", J.i18n.GT.$("Simplified Chinese"), "简体ä¸æ–‡", true), new J.i18n.Language("zh_TW", J.i18n.GT.$("Traditional Chinese"), "ç¹é«”ä¸æ–‡", true)]); +}); +c$.getSupported = Clazz.defineMethod(c$, "getSupported", +function(list, code){ +for (var i = list.length; --i >= 0; ) if (list[i].code.equalsIgnoreCase(code)) return list[i].code; + +for (var i = list.length; --i >= 0; ) if (list[i].code.startsWith(code)) return list[i].code; + +return null; +}, "~A,~S"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/i18n/Resource.js b/config/plugins/visualizations/jmol/static/j2s/J/i18n/Resource.js new file mode 100755 index 000000000000..46bcdb59f091 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/i18n/Resource.js @@ -0,0 +1,87 @@ +Clazz.declarePackage("J.i18n"); +Clazz.load(null, "J.i18n.Resource", ["java.util.Hashtable", "JU.PT", "$.Rdr", "J.translation.PO", "JU.Logger", "JV.FileManager"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.resource = null; +this.resourceMap = null; +Clazz.instantialize(this, arguments);}, J.i18n, "Resource", null); +Clazz.makeConstructor(c$, +function(resource, className){ +if (className == null) this.resourceMap = resource; + else this.resource = resource; +}, "~O,~S"); +c$.getResource = Clazz.defineMethod(c$, "getResource", +function(vwr, className, name){ +try { +var br = JV.FileManager.getBufferedReaderForResource(vwr, new J.translation.PO(), "J/translation/", (className.indexOf("Applet") >= 0 ? "JmolApplet/" : "Jmol/") + name + ".po"); +var data = new Array(1); +JU.Rdr.readAllAsString(br, 2147483647, false, data, 0); +var poData = data[0]; +return J.i18n.Resource.getResourceFromPO(poData); +} catch (e) { +if (Clazz.exceptionOf(e,"java.io.IOException")){ +return null; +} else { +throw e; +} +} +}, "JV.Viewer,~S,~S"); +Clazz.defineMethod(c$, "getString", +function(string){ +try { +return (this.resource == null ? this.resourceMap.get(string) : this.resource.getString(string)); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +return null; +} else { +throw e; +} +} +}, "~S"); +c$.getLanguage = Clazz.defineMethod(c$, "getLanguage", +function(){ +var language = null; +{ +language = Jmol.featureDetection.getDefaultLanguage().replace(/-/g,'_'); +}return language; +}); +c$.getResourceFromPO = Clazz.defineMethod(c$, "getResourceFromPO", +function(data){ +if (data == null || data.length == 0) return null; +var map = new java.util.Hashtable(); +try { +var lines = JU.PT.split(data, "\n"); +var mode = 0; +var msgstr = ""; +var msgid = ""; +for (var i = 0; i < lines.length; i++) { +var line = lines[i]; +if (line.length <= 2) { +if (mode == 2 && msgstr.length != 0 && msgid.length != 0) map.put(msgid, msgstr); +mode = 0; +} else if (line.indexOf("msgid") == 0) { +mode = 1; +msgid = J.i18n.Resource.fix(line); +} else if (line.indexOf("msgstr") == 0) { +mode = 2; +msgstr = J.i18n.Resource.fix(line); +} else if (mode == 1) { +msgid += J.i18n.Resource.fix(line); +} else if (mode == 2) { +msgstr += J.i18n.Resource.fix(line); +}} +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +JU.Logger.info(map.size() + " translations loaded"); +return (map.size() == 0 ? null : new J.i18n.Resource(map, null)); +}, "~S"); +c$.fix = Clazz.defineMethod(c$, "fix", +function(line){ +if (line.indexOf("\\\"") >= 0) line = JU.PT.rep(line, "\\\"", "\""); +return JU.PT.rep(line.substring(line.indexOf("\"") + 1, line.lastIndexOf("\"")), "\\n", "\n"); +}, "~S"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/image/AviCreator.js b/config/plugins/visualizations/jmol/static/j2s/J/image/AviCreator.js new file mode 100755 index 000000000000..d05c362326b0 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/image/AviCreator.js @@ -0,0 +1,11 @@ +Clazz.declarePackage("J.image"); +Clazz.load(["J.api.JmolMovieCreatorInterface"], "J.image.AviCreator", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.errorMsg = null; +Clazz.instantialize(this, arguments);}, J.image, "AviCreator", null, J.api.JmolMovieCreatorInterface); +Clazz.overrideMethod(c$, "createMovie", +function(vwr, files, width, height, fps, fileName){ +return this.errorMsg; +}, "JV.Viewer,~A,~N,~N,~N,~S"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/inchi/InChIJS.js b/config/plugins/visualizations/jmol/static/j2s/J/inchi/InChIJS.js new file mode 100755 index 000000000000..7e54bf549f8f --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/inchi/InChIJS.js @@ -0,0 +1,52 @@ +Clazz.declarePackage("J.inchi"); +Clazz.load(["J.api.JmolInChI"], "J.inchi.InChIJS", ["JU.PT"], function(){ +var c$ = Clazz.declareType(J.inchi, "InChIJS", null, J.api.JmolInChI); +/*LV!1824 unnec constructor*/Clazz.overrideMethod(c$, "getInchi", +function(vwr, atoms, molData, options){ +if (atoms == null ? molData == null : atoms.isEmpty()) return ""; +var ret = ""; +try { +if (options == null) options = ""; +options = JU.PT.rep(JU.PT.rep(options.$replace('-', ' '), " ", " ").trim(), " ", " -").toLowerCase(); +if (options.length > 0) options = "-" + options; +if (molData == null) molData = vwr.getModelExtract(atoms, false, false, "MOL"); +if ((typeof(molData)=='string') && (molData).startsWith("InChI=")) { +{ +ret = (Jmol.inchiToInchiKey ? Jmol.inchiToInchiKey(molData) : ""); +}return ret; +}var haveKey = (options.indexOf("key") >= 0); +if (haveKey) { +options = options.$replace("inchikey", "key"); +}if (options.indexOf("fixedh?") >= 0) { +var fxd = this.getInchi(vwr, atoms, molData, options.$replace('?', ' ')); +options = JU.PT.rep(options, "-fixedh?", ""); +if (haveKey) options = JU.PT.rep(options, "-key", ""); +var inchi = this.getInchi(vwr, atoms, molData, options); +if (fxd != null && fxd.length > inchi.length) inchi = fxd; +return (haveKey ? this.getInchi(vwr, atoms, inchi, "-key") : inchi); +}{ +ret = (Jmol.molfileToInChI ? Jmol.molfileToInChI(molData, +options) : ""); +}} catch (e) { +{ +e = (e.getMessage$ ? e.getMessage$() : e); +}System.err.println("InChIJS exception: " + e); +} +return ret; +}, "JV.Viewer,JU.BS,~O,~S"); +{ +var wasmPath = "/_WASM"; +var es6Path = "/_ES6"; +try { +{ +var j2sPath = Jmol._applets.master._j2sFullPath; +// +Jmol.inchiPath = j2sPath + wasmPath; +// +var importPath = j2sPath + es6Path; +// +import(importPath + "/molfile-to-inchi.js"); +}} catch (t) { +} +}}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/io/DOMReader.js b/config/plugins/visualizations/jmol/static/j2s/J/io/DOMReader.js new file mode 100755 index 000000000000..0a97d816a72a --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/io/DOMReader.js @@ -0,0 +1,34 @@ +Clazz.declarePackage("J.io"); +(function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.fm = null; +this.vwr = null; +this.aDOMNode = null; +this.atomSetCollection = null; +this.htParams = null; +Clazz.instantialize(this, arguments);}, J.io, "DOMReader", null); +Clazz.prepareFields (c$, function(){ +this.aDOMNode = new Array(1); +}); +Clazz.makeConstructor(c$, +function(){ +}); +Clazz.defineMethod(c$, "set", +function(fileManager, vwr, DOMNode, htParams){ +this.fm = fileManager; +this.vwr = vwr; +this.aDOMNode[0] = DOMNode; +this.htParams = htParams; +}, "JV.FileManager,JV.Viewer,~O,java.util.Map"); +Clazz.defineMethod(c$, "run", +function(){ +var info = null; +{ +}if (info != null) this.htParams.put("nameSpaceInfo", info); +this.vwr.zap(false, true, false); +this.atomSetCollection = this.vwr.getModelAdapter().getAtomSetCollectionFromDOM(this.aDOMNode, this.htParams); +if ((typeof(this.atomSetCollection)=='string')) return; +this.fm.setFileInfo( Clazz.newArray(-1, ["JSNode"])); +}); +})(); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/io/FileReader.js b/config/plugins/visualizations/jmol/static/j2s/J/io/FileReader.js new file mode 100755 index 000000000000..455184498917 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/io/FileReader.js @@ -0,0 +1,92 @@ +Clazz.declarePackage("J.io"); +Clazz.load(null, "J.io.FileReader", ["java.io.BufferedReader", "JU.AU", "$.PT", "$.Rdr", "J.api.Interface", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.vwr = null; +this.fileNameIn = null; +this.fullPathNameIn = null; +this.nameAsGivenIn = null; +this.fileTypeIn = null; +this.atomSetCollection = null; +this.readerOrDocument = null; +this.htParams = null; +this.isAppend = false; +this.bytesOrStream = null; +Clazz.instantialize(this, arguments);}, J.io, "FileReader", null); +Clazz.makeConstructor(c$, +function(vwr, fileName, fullPathName, nameAsGiven, type, reader, htParams, isAppend){ +this.vwr = vwr; +this.fileNameIn = (fileName == null ? fullPathName : fileName); +this.fullPathNameIn = (fullPathName == null ? this.fileNameIn : fullPathName); +this.nameAsGivenIn = (nameAsGiven == null ? this.fileNameIn : nameAsGiven); +this.fileTypeIn = type; +if (reader != null) { +if (JU.AU.isAB(reader) || Clazz.instanceOf(reader,"java.io.BufferedInputStream")) { +this.bytesOrStream = reader; +reader = null; +} else if (Clazz.instanceOf(reader,"java.io.Reader") && !(Clazz.instanceOf(reader,"java.io.BufferedReader"))) { +reader = new java.io.BufferedReader(reader); +}}this.readerOrDocument = reader; +this.htParams = htParams; +this.isAppend = isAppend; +}, "JV.Viewer,~S,~S,~S,~S,~O,java.util.Map,~B"); +Clazz.defineMethod(c$, "run", +function(){ +if (!this.isAppend && this.vwr.displayLoadErrors) this.vwr.zap(false, true, false); +var errorMessage = null; +var t = null; +if (this.fullPathNameIn.contains("#_DOCACHE_")) this.readerOrDocument = J.io.FileReader.getChangeableReader(this.vwr, this.nameAsGivenIn, this.fullPathNameIn); +if (this.readerOrDocument == null) { +t = this.vwr.fm.getUnzippedReaderOrStreamFromName(this.fullPathNameIn, this.bytesOrStream, true, false, false, true, this.htParams); +if (t == null || (typeof(t)=='string')) { +errorMessage = (t == null ? "error opening:" + this.nameAsGivenIn : t); +if (!errorMessage.startsWith("NOTE:")) JU.Logger.error("file ERROR: " + this.fullPathNameIn + "\n" + errorMessage); +this.atomSetCollection = errorMessage; +return; +}if (Clazz.instanceOf(t,"java.io.BufferedReader")) { +this.readerOrDocument = t; +} else if (Clazz.instanceOf(t,"javajs.api.ZInputStream")) { +var name = this.fullPathNameIn; +var subFileList = null; +name = name.$replace('\\', '/'); +if (name.indexOf("|") >= 0 && !name.endsWith(".zip")) { +subFileList = JU.PT.split(name, "|"); +name = subFileList[0]; +}if (subFileList != null) this.htParams.put("subFileList", subFileList); +var zis = t; +var zipDirectory = this.vwr.fm.getZipDirectory(name, true, true); +this.atomSetCollection = t = this.vwr.fm.getJzu().getAtomSetCollectionOrBufferedReaderFromZip(this.vwr, zis, name, zipDirectory, this.htParams, 1, false); +try { +zis.close(); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +}}if (Clazz.instanceOf(t,"java.io.BufferedInputStream")) this.readerOrDocument = (J.api.Interface.getInterface("JU.BinaryDocument", this.vwr, "file")).setStream(t, !this.htParams.containsKey("isLittleEndian")); +if (this.readerOrDocument != null) { +this.atomSetCollection = this.vwr.getModelAdapter().getAtomSetCollectionReader(this.fullPathNameIn, this.fileTypeIn, this.readerOrDocument, this.htParams); +if (!((typeof(this.atomSetCollection)=='string'))) this.atomSetCollection = this.vwr.getModelAdapter().getAtomSetCollection(this.atomSetCollection); +try { +if (Clazz.instanceOf(this.readerOrDocument,"java.io.BufferedReader")) (this.readerOrDocument).close(); + else if (Clazz.instanceOf(this.readerOrDocument,"javajs.api.GenericBinaryDocument")) (this.readerOrDocument).close(); +} catch (e) { +if (Clazz.exceptionOf(e,"java.io.IOException")){ +} else { +throw e; +} +} +}if ((typeof(this.atomSetCollection)=='string')) return; +if (!this.isAppend && !this.vwr.displayLoadErrors) this.vwr.zap(false, true, false); +this.vwr.fm.setFileInfo( Clazz.newArray(-1, [this.fullPathNameIn, this.fileNameIn, this.nameAsGivenIn])); +}); +c$.getChangeableReader = Clazz.defineMethod(c$, "getChangeableReader", +function(vwr, nameAsGivenIn, fullPathNameIn){ +return JU.Rdr.getBR(vwr.getLigandModel(nameAsGivenIn, fullPathNameIn, "_file", null)); +}, "JV.Viewer,~S,~S"); +Clazz.defineMethod(c$, "getAtomSetCollection", +function(){ +return this.atomSetCollection; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/io/FilesReader.js b/config/plugins/visualizations/jmol/static/j2s/J/io/FilesReader.js new file mode 100755 index 000000000000..bbb7153d4c66 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/io/FilesReader.js @@ -0,0 +1,56 @@ +Clazz.declarePackage("J.io"); +Clazz.load(["J.api.JmolFilesReaderInterface"], "J.io.FilesReader", ["JU.Rdr", "J.api.Interface", "J.io.FileReader", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.fm = null; +this.vwr = null; +this.fullPathNamesIn = null; +this.namesAsGivenIn = null; +this.fileTypesIn = null; +this.atomSetCollection = null; +this.dataReaders = null; +this.htParams = null; +this.isAppend = false; +Clazz.instantialize(this, arguments);}, J.io, "FilesReader", null, J.api.JmolFilesReaderInterface); +/*LV!1824 unnec constructor*/Clazz.overrideMethod(c$, "set", +function(fileManager, vwr, name, nameAsGiven, types, readers, htParams, isAppend){ +this.fm = fileManager; +this.vwr = vwr; +this.fullPathNamesIn = name; +this.namesAsGivenIn = nameAsGiven; +this.fileTypesIn = types; +this.dataReaders = readers; +this.htParams = htParams; +this.isAppend = isAppend; +}, "JV.FileManager,JV.Viewer,~A,~A,~A,~A,java.util.Map,~B"); +Clazz.overrideMethod(c$, "run", +function(){ +if (!this.isAppend && this.vwr.displayLoadErrors) this.vwr.zap(false, true, false); +var getReadersOnly = !this.vwr.displayLoadErrors; +this.atomSetCollection = this.vwr.getModelAdapter().getAtomSetCollectionReaders(this, this.fullPathNamesIn, this.fileTypesIn, this.htParams, getReadersOnly); +this.dataReaders = null; +if (getReadersOnly && !((typeof(this.atomSetCollection)=='string'))) { +this.atomSetCollection = this.vwr.getModelAdapter().getAtomSetCollectionFromSet(this.atomSetCollection, null, this.htParams); +}if ((typeof(this.atomSetCollection)=='string')) { +JU.Logger.error("file ERROR: " + this.atomSetCollection); +return; +}if (!this.isAppend && !this.vwr.displayLoadErrors) this.vwr.zap(false, true, false); +this.fm.setFileInfo( Clazz.newArray(-1, [this.dataReaders == null ? this.fullPathNamesIn[0] : "String[]"])); +}); +Clazz.overrideMethod(c$, "getBufferedReaderOrBinaryDocument", +function(i, forceBinary){ +if (this.dataReaders != null) return (forceBinary ? null : this.dataReaders[i].getBufferedReader()); +var name = this.fullPathNamesIn[i]; +if (name.contains("#_DOCACHE_")) return J.io.FileReader.getChangeableReader(this.vwr, this.namesAsGivenIn[i], name); +var t = this.fm.getUnzippedReaderOrStreamFromName(name, null, false, forceBinary, false, true, this.htParams); +if (Clazz.instanceOf(t,"java.io.BufferedInputStream") && JU.Rdr.isZipS(t)) { +var zipDirectory = this.fm.getZipDirectory(name, true, true); +t = this.fm.getBufferedInputStreamOrErrorMessageFromName(name, this.fullPathNamesIn[i], false, false, null, false, true); +t = this.fm.getJzu().getAtomSetCollectionOrBufferedReaderFromZip(this.vwr, t, name, zipDirectory, this.htParams, 1, true); +}return (Clazz.instanceOf(t,"java.io.BufferedInputStream") ? (J.api.Interface.getInterface("JU.BinaryDocument", this.vwr, "file")).setStream(t, true) : Clazz.instanceOf(t,"java.io.BufferedReader") || Clazz.instanceOf(t,"javajs.api.GenericBinaryDocument") ? t : t == null ? "error opening:" + this.namesAsGivenIn[i] : t); +}, "~N,~B"); +Clazz.overrideMethod(c$, "getAtomSetCollection", +function(){ +return this.atomSetCollection; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/io/JmolUtil.js b/config/plugins/visualizations/jmol/static/j2s/J/io/JmolUtil.js new file mode 100755 index 000000000000..b9b67c369669 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/io/JmolUtil.js @@ -0,0 +1,251 @@ +Clazz.declarePackage("J.io"); +Clazz.load(null, "J.io.JmolUtil", ["java.net.URL", "java.util.Hashtable", "JU.AU", "$.Lst", "$.OC", "$.PT", "$.Rdr", "J.adapter.smarter.AtomSetCollection", "J.api.Interface", "JU.Logger", "JV.FileManager", "$.Viewer"], function(){ +var c$ = Clazz.declareType(J.io, "JmolUtil", null); +/*LV!1824 unnec constructor*/Clazz.defineMethod(c$, "getImage", +function(vwr, fullPathNameOrBytes, echoName, forceSync){ +var image = null; +var info = null; +var apiPlatform = vwr.apiPlatform; +var createImage = false; +var fullPathName = "" + fullPathNameOrBytes; +if ((typeof(fullPathNameOrBytes)=='string')) { +var isBMP = fullPathName.toUpperCase().endsWith("BMP"); +if (forceSync || fullPathName.indexOf("|") > 0 || isBMP) { +var ret = vwr.fm.getFileAsBytes(fullPathName, null); +if (!JU.AU.isAB(ret)) return "" + ret; +if (JV.Viewer.isJS) info = Clazz.newArray(-1, [echoName, fullPathNameOrBytes, ret]); + else image = apiPlatform.createImage(ret); +} else if (JU.OC.urlTypeIndex(fullPathName) >= 0) { +if (JV.Viewer.isJS) info = Clazz.newArray(-1, [echoName, fullPathNameOrBytes, null]); + else try { +image = apiPlatform.createImage( new java.net.URL(Clazz.castNullAs("java.net.URL"), fullPathName, null)); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +return "bad URL: " + fullPathName; +} else { +throw e; +} +} +} else { +createImage = true; +}} else if (JV.Viewer.isJS) { +info = Clazz.newArray(-1, [echoName, JU.Rdr.guessMimeTypeForBytes(fullPathNameOrBytes), fullPathNameOrBytes]); +} else { +createImage = true; +}if (createImage) image = apiPlatform.createImage("\1close".equals(fullPathNameOrBytes) ? "\1close" + echoName : fullPathNameOrBytes); + else if (info != null) image = apiPlatform.createImage(info); +{ +return image; +}}, "JV.Viewer,~O,~S,~B"); +Clazz.defineMethod(c$, "getAtomSetCollectionOrBufferedReaderFromZip", +function(vwr, is, fileName, zipDirectory, htParams, subFilePtr, asBufferedReader){ +var adapter = vwr.getModelAdapter(); +var doCombine = (subFilePtr == 1); +htParams.put("zipSet", fileName); +var subFileList = htParams.get("subFileList"); +if (subFileList == null) subFileList = this.getSpartanSubfiles(zipDirectory); +var subFileName = (subFileList == null || subFilePtr >= subFileList.length ? htParams.get("SubFileName") : subFileList[subFilePtr]); +if (subFileName != null && (subFileName.startsWith("/") || subFileName.startsWith("\\"))) subFileName = subFileName.substring(1); +var selectedFile = 0; +if (subFileName == null && htParams.containsKey("modelNumber")) { +selectedFile = (htParams.get("modelNumber")).intValue(); +if (selectedFile > 0 && doCombine) htParams.remove("modelNumber"); +}var manifest = htParams.get("manifest"); +var useFileManifest = (manifest == null); +if (useFileManifest) manifest = (zipDirectory.length > 0 ? zipDirectory[0] : ""); +var haveManifest = (manifest.length > 0); +if (haveManifest) { +if (JU.Logger.debugging) JU.Logger.debug("manifest for " + fileName + ":\n" + manifest); +}var ignoreErrors = (manifest.indexOf("IGNORE_ERRORS") >= 0); +var selectAll = (manifest.indexOf("IGNORE_MANIFEST") >= 0); +var exceptFiles = (manifest.indexOf("EXCEPT_FILES") >= 0); +if (selectAll || subFileName != null) haveManifest = false; +if (useFileManifest && haveManifest) { +var path = JV.FileManager.getManifestScriptPath(manifest); +if (path != null) { +return "NOTE: file recognized as a script file: " + fileName + path + "\n"; +}}var vCollections = new JU.Lst(); +var htCollections = (haveManifest ? new java.util.Hashtable() : null); +var nFiles = 0; +try { +var spartanData = (this.isSpartanZip(zipDirectory) ? vwr.fm.spartanUtil().getData(is, zipDirectory) : null); +var zpt = vwr.getJzt(); +var ret; +if (spartanData != null) { +var reader = JU.Rdr.getBR(spartanData.toString()); +if (asBufferedReader) return reader; +ret = adapter.getAtomSetCollectionFromReader(fileName, reader, htParams); +if ((typeof(ret)=='string')) return ret; +if (Clazz.instanceOf(ret,"J.adapter.smarter.AtomSetCollection")) { +var atomSetCollection = ret; +if (atomSetCollection.errorMessage != null) { +if (ignoreErrors) return null; +return atomSetCollection.errorMessage; +}return atomSetCollection; +}if (ignoreErrors) return null; +return "unknown reader error"; +}if (Clazz.instanceOf(is,"java.io.BufferedInputStream")) is = JU.Rdr.getPngZipStream(is, true); +var zis = zpt.newZipInputStream(is); +var ze; +if (haveManifest) manifest = '|' + manifest.$replace('\r', '|').$replace('\n', '|') + '|'; +while ((ze = zis.getNextEntry()) != null && (selectedFile <= 0 || vCollections.size() < selectedFile)) { +if (ze.isDirectory()) continue; +var thisEntry = ze.getName(); +if (subFileName != null && !thisEntry.equals(subFileName)) continue; +if (subFileName != null) htParams.put("subFileName", subFileName); +if (thisEntry.startsWith("JmolManifest") || haveManifest && exceptFiles == manifest.indexOf("|" + thisEntry + "|") >= 0) continue; +var bytes = JU.Rdr.getLimitedStreamBytes(zis, ze.getSize()); +if (JU.Rdr.isGzipB(bytes)) bytes = JU.Rdr.getLimitedStreamBytes(zpt.getUnGzippedInputStream(bytes), -1); +if (JU.Rdr.isZipB(bytes) || JU.Rdr.isPngZipB(bytes)) { +var bis = JU.Rdr.getBIS(bytes); +var zipDir2 = zpt.getZipDirectoryAndClose(bis, "JmolManifest"); +bis = JU.Rdr.getBIS(bytes); +var atomSetCollections = this.getAtomSetCollectionOrBufferedReaderFromZip(vwr, bis, fileName + "|" + thisEntry, zipDir2, htParams, ++subFilePtr, asBufferedReader); +if ((typeof(atomSetCollections)=='string')) { +if (ignoreErrors) continue; +return atomSetCollections; +} else if (Clazz.instanceOf(atomSetCollections,"J.adapter.smarter.AtomSetCollection") || Clazz.instanceOf(atomSetCollections,"JU.Lst")) { +if (haveManifest && !exceptFiles) htCollections.put(thisEntry, atomSetCollections); + else vCollections.addLast(atomSetCollections); +} else if (Clazz.instanceOf(atomSetCollections,"java.io.BufferedReader")) { +if (doCombine) zis.close(); +return atomSetCollections; +} else { +if (ignoreErrors) continue; +zis.close(); +return "unknown zip reader error"; +}} else if (JU.Rdr.isPickleB(bytes)) { +var bis = JU.Rdr.getBIS(bytes); +if (doCombine) zis.close(); +return bis; +} else { +var sData; +if (JU.Rdr.isCompoundDocumentB(bytes)) { +var jd = J.api.Interface.getInterface("JU.CompoundDocument", vwr, "file"); +jd.setDocStream(zpt, JU.Rdr.getBIS(bytes)); +sData = jd.getAllDataFiles("Molecule", "Input").toString(); +} else { +sData = JU.Rdr.fixUTF(bytes); +}var reader = JU.Rdr.getBR(sData); +if (asBufferedReader) { +if (doCombine) zis.close(); +return reader; +}var fname = fileName + "|" + ze.getName(); +ret = adapter.getAtomSetCollectionFromReader(fname, reader, htParams); +if (!(Clazz.instanceOf(ret,"J.adapter.smarter.AtomSetCollection"))) { +if (ignoreErrors) continue; +zis.close(); +return "" + ret; +}if (haveManifest && !exceptFiles) htCollections.put(thisEntry, ret); + else vCollections.addLast(ret); +var a = ret; +if (a.errorMessage != null) { +if (ignoreErrors) continue; +zis.close(); +return a.errorMessage; +}}} +if (doCombine) zis.close(); +if (haveManifest && !exceptFiles) { +var list = JU.PT.split(manifest, "|"); +for (var i = 0; i < list.length; i++) { +var file = list[i]; +if (file.length == 0 || file.indexOf("#") == 0) continue; +if (htCollections.containsKey(file)) vCollections.addLast(htCollections.get(file)); + else if (JU.Logger.debugging) JU.Logger.debug("manifested file " + file + " was not found in " + fileName); +} +}if (!doCombine) return vCollections; +var result = (vCollections.size() == 1 && Clazz.instanceOf(vCollections.get(0),"J.adapter.smarter.AtomSetCollection") ? vCollections.get(0) : new J.adapter.smarter.AtomSetCollection("Array", null, null, vCollections)); +if (result.errorMessage != null) { +if (ignoreErrors) return null; +return result.errorMessage; +}if (nFiles == 1) selectedFile = 1; +if (selectedFile > 0 && selectedFile <= vCollections.size()) return vCollections.get(selectedFile - 1); +return result; +} catch (e$$) { +if (Clazz.exceptionOf(e$$, Exception)){ +var e = e$$; +{ +if (ignoreErrors) return null; +JU.Logger.error("" + e); +return "" + e; +} +} else if (Clazz.exceptionOf(e$$, Error)){ +var er = e$$; +{ +JU.Logger.errorEx(null, er); +return "" + er; +} +} else { +throw e$$; +} +} +}, "JV.Viewer,java.io.InputStream,~S,~A,java.util.Map,~N,~B"); +Clazz.defineMethod(c$, "getCachedPngjBytes", +function(fm, pathName){ +if (pathName.startsWith("file:///")) pathName = "file:" + pathName.substring(7); +JU.Logger.info("JmolUtil checking PNGJ cache for " + pathName); +var shortName = this.shortSceneFilename(pathName); +if (fm.pngjCache == null && !this.clearAndCachePngjFile(fm, Clazz.newArray(-1, [pathName, null]))) return null; +var cache = fm.pngjCache; +var isMin = (pathName.indexOf(".min.") >= 0); +if (!isMin) { +var cName = fm.getCanonicalName(JU.Rdr.getZipRoot(pathName)); +if (!cache.containsKey(cName) && !this.clearAndCachePngjFile(fm, Clazz.newArray(-1, [pathName, null]))) return null; +if (pathName.indexOf("|") < 0) shortName = cName; +}if (cache.containsKey(shortName)) { +JU.Logger.info("FileManager using memory cache " + shortName); +return fm.pngjCache.get(shortName); +}if (!isMin || !this.clearAndCachePngjFile(fm, Clazz.newArray(-1, [pathName, null]))) return null; +JU.Logger.info("FileManager using memory cache " + shortName); +return cache.get(shortName); +}, "JV.FileManager,~S"); +Clazz.defineMethod(c$, "clearAndCachePngjFile", +function(fm, data){ +fm.pngjCache = new java.util.Hashtable(); +if (data == null || data[0] == null) return false; +data[0] = JU.Rdr.getZipRoot(data[0]); +var shortName = this.shortSceneFilename(data[0]); +var cache = fm.pngjCache; +try { +data[1] = fm.vwr.getJzt().cacheZipContents(JU.Rdr.getPngZipStream(fm.getBufferedInputStreamOrErrorMessageFromName(data[0], null, false, false, null, false, true), true), shortName, cache, false); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +return false; +} else { +throw e; +} +} +if (data[1] == null) return false; +var bytes = data[1].getBytes(); +cache.put(fm.getCanonicalName(data[0]), bytes); +if (shortName.indexOf("_scene_") >= 0) { +cache.put(this.shortSceneFilename(data[0]), bytes); +bytes = cache.remove(shortName + "|state.spt"); +if (bytes != null) cache.put(this.shortSceneFilename(data[0] + "|state.spt"), bytes); +}return true; +}, "JV.FileManager,~A"); +Clazz.defineMethod(c$, "shortSceneFilename", +function(pathName){ +var pt = pathName.indexOf("_scene_") + 7; +if (pt < 7) return pathName; +var s = ""; +if (pathName.endsWith("|state.spt")) { +var pt1 = pathName.indexOf('.', pt); +if (pt1 < 0) return pathName; +s = pathName.substring(pt, pt1); +}var pt2 = pathName.lastIndexOf("|"); +return pathName.substring(0, pt) + s + (pt2 > 0 ? pathName.substring(pt2) : ""); +}, "~S"); +Clazz.defineMethod(c$, "getSpartanSubfiles", +function(zipDirectory){ +var name = (zipDirectory.length < 2 ? null : zipDirectory[1]); +return (name == null || zipDirectory.length != 2 || !name.endsWith(".spardir/") ? null : Clazz.newArray(-1, ["", JU.PT.trim(name, "/")])); +}, "~A"); +Clazz.defineMethod(c$, "isSpartanZip", +function(zipDirectory){ +for (var i = 1; i < zipDirectory.length; i++) if (zipDirectory[i].endsWith(".spardir/") || zipDirectory[i].indexOf("_spartandir") >= 0) return true; + +return false; +}, "~A"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jsv/JDXMOLParser.js b/config/plugins/visualizations/jmol/static/j2s/J/jsv/JDXMOLParser.js new file mode 100755 index 000000000000..e79e4693aa3b --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jsv/JDXMOLParser.js @@ -0,0 +1,293 @@ +Clazz.declarePackage("J.jsv"); +Clazz.load(["J.api.JmolJDXMOLParser"], "J.jsv.JDXMOLParser", ["java.util.Hashtable", "JU.BS", "$.Lst", "$.PT", "$.SB", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.line = null; +this.lastModel = ""; +this.thisModelID = null; +this.baseModel = null; +this.vibScale = 0; +this.piUnitsX = null; +this.piUnitsY = null; +this.loader = null; +this.modelIdList = ""; +this.peakIndex = null; +this.peakFilePath = null; +Clazz.instantialize(this, arguments);}, J.jsv, "JDXMOLParser", null, J.api.JmolJDXMOLParser); +/*LV!1824 unnec constructor*/Clazz.overrideMethod(c$, "set", +function(loader, filePath, htParams){ +this.loader = loader; +this.peakFilePath = filePath; +this.peakIndex = Clazz.newIntArray (1, 0); +if (htParams != null) { +htParams.remove("modelNumber"); +if (htParams.containsKey("zipSet")) { +this.peakIndex = htParams.get("peakIndex"); +if (this.peakIndex == null) { +this.peakIndex = Clazz.newIntArray (1, 0); +htParams.put("peakIndex", this.peakIndex); +}if (!htParams.containsKey("subFileName")) this.peakFilePath = JU.PT.split(filePath, "|")[0]; +}}return this; +}, "J.api.JmolJDXMOLReader,~S,java.util.Map"); +Clazz.overrideMethod(c$, "getAttribute", +function(line, tag){ +var attr = JU.PT.getQuotedAttribute(line, tag); +return (attr == null ? "" : attr); +}, "~S,~S"); +Clazz.overrideMethod(c$, "getRecord", +function(key){ +if (this.line == null || this.line.indexOf(key) < 0) return null; +var s = this.line; +while (s.indexOf(">") < 0) s += " " + this.readLine(); + +return this.line = s; +}, "~S"); +Clazz.overrideMethod(c$, "readModels", +function(){ +if (!this.findRecord("Models")) return false; +this.line = ""; +this.thisModelID = ""; +var isFirst = true; +while (true) { +this.line = this.loader.discardLinesUntilNonBlank(); +if (this.getRecord("") < 0) s += " " + this.readLine(); + +s = s.trim(); +}s = JU.PT.replaceAllCharacters(s, "()<>", " ").trim(); +if (s.length == 0) break; +var pt = s.indexOf("'"); +if (pt >= 0) { +var pt2 = s.indexOf("'", pt + 1); +s = s.substring(0, pt) + JU.PT.rep(s.substring(pt + 1, pt2), ",", ";") + s.substring(pt2 + 1); +}JU.Logger.info("Peak Assignment: " + s); +var tokens = JU.PT.split(s, ","); +list.addLast(tokens); +} +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.error("Error reading peak assignments at " + this.line + ": " + e); +} else { +throw e; +} +} +return list; +}, "~N,~B"); +Clazz.overrideMethod(c$, "setACDAssignments", +function(model, mytype, peakCount, acdlist, molFile){ +try { +if (peakCount >= 0) this.peakIndex = Clazz.newIntArray(-1, [peakCount]); +var isMS = (mytype.indexOf("MASS") == 0); +var file = " file=" + JU.PT.esc(this.peakFilePath.$replace('\\', '/')); +model = " model=" + JU.PT.esc(model + " (assigned)"); +this.piUnitsX = ""; +this.piUnitsY = ""; +var dx = this.getACDPeakWidth(mytype) / 2; +var htSets = new java.util.Hashtable(); +var list = new JU.Lst(); +var zzcMap = null; +var ptx; +var pta; +var nAtoms = 0; +if (isMS) { +zzcMap = new java.util.Hashtable(); +var tokens = JU.PT.split(molFile, "M ZZC"); +for (var i = tokens.length; --i >= 1; ) { +var ab = JU.PT.getTokens(tokens[i]); +nAtoms = Math.max(nAtoms, JU.PT.parseInt(ab[0])); +zzcMap.put(ab[1], ab[0]); +} +ptx = 4; +pta = 0; +} else if (mytype.indexOf("NMR") >= 0) { +ptx = 0; +pta = 3; +} else { +ptx = 0; +pta = 2; +}var nPeaks = acdlist.size(); +for (var i = 0; i < nPeaks; i++) { +var data = acdlist.get(i); +var x = JU.PT.parseFloat(data[ptx]); +var a = data[pta]; +if (isMS) a = this.fixACDAtomList(a, zzcMap, nAtoms); + else a = a.$replace(';', ','); +if (a.indexOf("select") >= 0) { +var pt = a.indexOf("select atomno="); +if (pt < 0) continue; +a = JU.PT.split(a.substring(pt + 14), " ")[0]; +}var title = (isMS ? "m/z=" + Math.round(x) + ": " + data[2] + " (" + data[1] + ")" : pta == 2 ? "" + (Math.round(x * 10) / 10) : null); +this.getStringInfo(file, title, mytype, model, a, htSets, "" + x, list, " atoms=\"%ATOMS%\" xMin=\"" + (x - dx) + "\" xMax=\"" + (x + dx) + "\">"); +} +return this.setPeakData(list, 0); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +return 0; +} else { +throw e; +} +} +}, "~S,~S,~N,JU.Lst,~S"); +Clazz.defineMethod(c$, "fixACDAtomList", +function(atoms, zzcMap, nAtoms){ +atoms = atoms.trim(); +var tokens = JU.PT.getTokens(atoms.$replace(';', ' ')); +var bs = new JU.BS(); +var isM = false; +for (var i = 0; i < tokens.length; i++) { +var a = tokens[i]; +isM = (a.indexOf("M") >= 0); +if (isM) a = "1-" + nAtoms; +var pt = a.indexOf('-'); +if (pt >= 0) { +var i1 = JU.PT.parseInt(a.substring(0, pt)); +var i2 = JU.PT.parseInt(a.substring(pt + 1)) + 1; +for (var k = i1; k < i2; k++) bs.set(isM ? k : JU.PT.parseInt(zzcMap.get("" + k))); + +} else { +bs.set(JU.PT.parseInt(zzcMap.get(a))); +}} +var s = bs.toJSON(); +return s.substring(1, s.length - 1); +}, "~S,java.util.Map,~N"); +Clazz.defineMethod(c$, "getACDPeakWidth", +function(type){ +return (type.indexOf("HNMR") >= 0 ? 0.05 : type.indexOf("CNMR") >= 0 ? 1 : type.indexOf("MASS") >= 0 ? 1 : 10); +}, "~S"); +Clazz.overrideMethod(c$, "readPeaks", +function(isSignals, peakCount){ +try { +if (peakCount >= 0) this.peakIndex = Clazz.newIntArray(-1, [peakCount]); +var offset = (isSignals ? 1 : 0); +var tag1 = (isSignals ? "Signals" : "Peaks"); +var tag2 = (isSignals ? " "); +return; +}this.modelIdList += key; +this.baseModel = this.getAttribute(this.line, "baseModel"); +while (this.line.indexOf(">") < 0 && this.line.indexOf("type") < 0) this.readLine(); + +var modelType = this.getAttribute(this.line, "type").toLowerCase(); +this.vibScale = JU.PT.parseFloat(this.getAttribute(this.line, "vibrationScale")); +if (modelType.equals("xyzvib")) modelType = "xyz"; + else if (modelType.length == 0) modelType = null; +var sb = new JU.SB(); +while (this.readLine() != null && !this.line.contains("")) sb.append(this.line).appendC('\n'); + +this.loader.processModelData(sb.toString(), this.thisModelID, modelType, this.baseModel, this.lastModel, NaN, this.vibScale, isFirst); +}, "~B"); +Clazz.defineMethod(c$, "findRecord", +function(tag){ +if (this.line == null) this.readLine(); +if (this.line != null && this.line.indexOf("<" + tag) < 0) this.line = this.loader.discardLinesUntilContains2("<" + tag, "##"); +return (this.line != null && this.line.indexOf("<" + tag) >= 0); +}, "~S"); +Clazz.defineMethod(c$, "readLine", +function(){ +return this.line = this.loader.rd(); +}); +Clazz.overrideMethod(c$, "setLine", +function(s){ +this.line = s; +}, "~S"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jsv/JSpecView.js b/config/plugins/visualizations/jmol/static/j2s/J/jsv/JSpecView.js new file mode 100755 index 000000000000..9292f409ffc6 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jsv/JSpecView.js @@ -0,0 +1,134 @@ +Clazz.declarePackage("J.jsv"); +Clazz.load(["J.api.JmolJSpecView"], "J.jsv.JSpecView", ["java.util.Hashtable", "JU.BS", "$.Lst", "$.PT", "JU.Escape", "$.Logger", "JV.FileManager"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.vwr = null; +Clazz.instantialize(this, arguments);}, J.jsv, "JSpecView", null, J.api.JmolJSpecView); +Clazz.overrideMethod(c$, "setViewer", +function(vwr){ +this.vwr = vwr; +}, "JV.Viewer"); +Clazz.overrideMethod(c$, "atomPicked", +function(atomIndex){ +if (atomIndex < 0) return; +var peak = this.getPeakAtomRecord(atomIndex); +if (peak != null) this.sendJSpecView(peak + " src=\"JmolAtomSelect\""); +}, "~N"); +Clazz.defineMethod(c$, "getPeakAtomRecord", +function(atomIndex){ +var atoms = this.vwr.ms.at; +var iModel = atoms[atomIndex].mi; +var type = null; +switch (atoms[atomIndex].getElementNumber()) { +case 1: +type = "1HNMR"; +break; +case 6: +type = "13CNMR"; +break; +default: +return null; +} +var peaks = this.vwr.ms.getInfo(iModel, "jdxAtomSelect_" + type); +if (peaks == null) return null; +this.vwr.ms.htPeaks = new java.util.Hashtable(); +var htPeaks = this.vwr.ms.htPeaks; +for (var i = 0; i < peaks.size(); i++) { +var peak = peaks.get(i); +System.out.println("Jmol JSpecView.java peak=" + peak); +var bsPeak = htPeaks.get(peak); +System.out.println("Jmol JSpecView.java bspeak=" + bsPeak); +if (bsPeak == null) { +htPeaks.put(peak, bsPeak = new JU.BS()); +var satoms = JU.PT.getQuotedAttribute(peak, "atoms"); +var select = JU.PT.getQuotedAttribute(peak, "select"); +System.out.println("Jmol JSpecView.java satoms select " + satoms + " " + select); +var script = ""; +if (satoms != null) script += "visible & (atomno=" + JU.PT.rep(satoms, ",", " or atomno=") + ")"; + else if (select != null) script += "visible & (" + select + ")"; +System.out.println("Jmol JSpecView.java script : " + script); +bsPeak.or(this.vwr.getAtomBitSet(script)); +}System.out.println("Jmol JSpecView bsPeak now : " + bsPeak + " " + atomIndex); +if (bsPeak.get(atomIndex)) return peak; +} +return null; +}, "~N"); +Clazz.defineMethod(c$, "sendJSpecView", +function(peak){ +var msg = JU.PT.getQuotedAttribute(peak, "title"); +if (msg != null) this.vwr.scriptEcho(JU.Logger.debugging ? peak : msg); +peak = this.vwr.fullName + "JSpecView: " + peak; +JU.Logger.info("Jmol.JSpecView.sendJSpecView Jmol>JSV " + peak); +this.vwr.sm.syncSend(peak, ">", 0); +}, "~S"); +Clazz.overrideMethod(c$, "setModel", +function(modelIndex){ +var syncMode = ("sync on".equals(this.vwr.ms.getInfoM("jmolscript")) ? 1 : this.vwr.sm.getSyncMode()); +if (syncMode != 1) return; +var peak = this.vwr.ms.getInfo(modelIndex, "jdxModelSelect"); +if (peak != null) this.sendJSpecView(peak + " src=\"Jmol\""); +}, "~N"); +Clazz.overrideMethod(c$, "getBaseModelIndex", +function(modelIndex){ +var baseModel = this.vwr.ms.getInfo(modelIndex, "jdxBaseModel"); +if (baseModel != null) for (var i = this.vwr.ms.mc; --i >= 0; ) if (baseModel.equals(this.vwr.ms.getInfo(i, "jdxModelID"))) return i; + +return modelIndex; +}, "~N"); +Clazz.overrideMethod(c$, "processSync", +function(script, jsvMode){ +if (JU.Logger.debugging) JU.Logger.info("J.jsv.JSpecView jsvMode=" + jsvMode + " script=" + script); +switch (jsvMode) { +default: +return null; +case 0: +this.vwr.sm.syncSend(this.vwr.fullName + "JSpecView" + script.substring(10), ">", 0); +return null; +case 77: +case 28: +case 35: +this.vwr.sm.syncSend(this.vwr.fullName + "JSpecView:" + script, ">", 0); +return null; +case 21: +if (this.vwr.isApplet) return null; +return null; +case 14: +var filename = JU.PT.getQuotedAttribute(script, "file"); +var isSimulation = (filename != null && filename.startsWith(JV.FileManager.SIMULATION_PROTOCOL)); +var id = (!isSimulation || this.vwr.isApplet ? "" : JU.PT.getQuotedAttribute(filename.$replace('\'', '"'), "id")); +if (isSimulation && !this.vwr.isApplet && (filename.startsWith(JV.FileManager.SIMULATION_PROTOCOL + "C13/MOL=") || filename.startsWith(JV.FileManager.SIMULATION_PROTOCOL + "H1/MOL="))) filename = null; + else filename = JU.PT.rep(filename, "#molfile", ""); +var modelID = (isSimulation ? "molfile" : JU.PT.getQuotedAttribute(script, "model")); +var baseModel = JU.PT.getQuotedAttribute(script, "baseModel"); +var atoms = JU.PT.getQuotedAttribute(script, "atoms"); +var select = JU.PT.getQuotedAttribute(script, "select"); +var script2 = JU.PT.getQuotedAttribute(script, "script"); +if (id == null || id.length == 0) id = (modelID == null ? null : (filename == null ? "" : filename + "#") + modelID); +if ("".equals(baseModel)) id += ".baseModel"; +var modelIndex = (id == null ? -3 : this.vwr.getModelIndexFromId(id)); +if (modelIndex == -2) return null; +if (modelIndex != -1 || filename == null) { +script = ""; +} else if (isSimulation && !this.vwr.isApplet) { +return null; +} else { +if (isSimulation) filename += "#molfile"; +script = "load " + JU.PT.esc(filename); +}if (id != null) script += ";model " + JU.PT.esc(id); +if (atoms != null) script += ";select visible & (@" + JU.PT.rep(atoms, ",", " or @") + ")"; + else if (select != null) script += ";select visible & (" + select + ")"; +if (script2 != null) script += ";" + script2; +return script; +case 7: +var list = JU.Escape.unescapeStringArray(script.substring(7)); +var peaks = new JU.Lst(); +var type = "1HNMR"; +for (var i = 0; i < list.length; i++) { +if (i == 0 && list[i].indexOf(JV.FileManager.SIMULATION_PROTOCOL + "C13/") >= 0) type = "13CNMR"; +peaks.addLast(list[i]); +} +this.vwr.ms.setInfo(this.vwr.am.cmi, "jdxAtomSelect_" + type, peaks); +return null; +} +}, "~S,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/api/MeshDataServer.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/api/MeshDataServer.js new file mode 100755 index 000000000000..ec87297a5f68 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/api/MeshDataServer.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.jvxl.api"); +Clazz.declareInterface(J.jvxl.api, "MeshDataServer", J.jvxl.api.VertexDataServer); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/api/VertexDataServer.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/api/VertexDataServer.js new file mode 100755 index 000000000000..a90d248928a1 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/api/VertexDataServer.js @@ -0,0 +1,3 @@ +Clazz.declarePackage("J.jvxl.api"); +Clazz.declareInterface(J.jvxl.api, "VertexDataServer"); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/calc/MarchingCubes.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/calc/MarchingCubes.js new file mode 100755 index 000000000000..9a88925ac9fc --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/calc/MarchingCubes.js @@ -0,0 +1,337 @@ +Clazz.declarePackage("J.jvxl.calc"); +Clazz.load(["JU.TriangleData", "JU.BS", "$.P3", "$.SB", "$.V3"], "J.jvxl.calc.MarchingCubes", ["J.jvxl.data.JvxlCoder"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.surfaceReader = null; +this.volumeData = null; +this.contourType = 0; +this.isContoured = false; +this.cutoff = 0; +this.isCutoffAbsolute = false; +this.isSquared = false; +this.isXLowToHigh = false; +this.cubeCountX = 0; +this.cubeCountY = 0; +this.cubeCountZ = 0; +this.nY = 0; +this.nZ = 0; +this.yzCount = 0; +this.colorDensity = false; +this.integrateSquared = true; +this.bsVoxels = null; +this.bsExcludedVertices = null; +this.bsExcludedTriangles = null; +this.bsExcludedPlanes = null; +this.edgeData = null; +this.excludePartialCubes = true; +this.isDensityRange = false; +this.mode = 0; +this.vertexValues = null; +this.edgeCount = 0; +this.voxelVertexVectors = null; +this.edgeVectors = null; +this.edgePointIndexes = null; +this.isoPointIndexPlanes = null; +this.yzPlanes = null; +this.mappingPlane = null; +this.allInside = false; +this.$isInside = false; +this.offset = null; +this.voxelData = null; +this.nTriangles = 0; +this.bsValues = null; +this.pt0 = null; +this.pointA = null; +this.edgeVertexPointers = null; +this.edgeVertexPlanes = null; +this.fReturn = null; +this.linearOffsets = null; +Clazz.instantialize(this, arguments);}, J.jvxl.calc, "MarchingCubes", JU.TriangleData); +Clazz.prepareFields (c$, function(){ +this.edgeData = new JU.SB(); +this.vertexValues = Clazz.newFloatArray (8, 0); +this.voxelVertexVectors = new Array(8); +this.edgeVectors = new Array(12); +{ +for (var i = 12; --i >= 0; ) this.edgeVectors[i] = new JU.V3(); + +}this.edgePointIndexes = Clazz.newIntArray (12, 0); +this.bsValues = new JU.BS(); +this.pt0 = new JU.P3(); +this.pointA = new JU.P3(); +this.fReturn = Clazz.newFloatArray (1, 0); +this.linearOffsets = Clazz.newIntArray (8, 0); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.calc.MarchingCubes, []); +}); +Clazz.makeConstructor(c$, +function(surfaceReader, volumeData, params, bsVoxels){ +Clazz.superConstructor (this, J.jvxl.calc.MarchingCubes, []); +this.excludePartialCubes = true; +this.surfaceReader = surfaceReader; +this.bsVoxels = bsVoxels; +var bsExcluded = params.bsExcluded; +this.bsExcludedVertices = (bsExcluded[0] == null ? bsExcluded[0] = new JU.BS() : bsExcluded[0]); +this.bsExcludedPlanes = (bsExcluded[2] == null ? bsExcluded[2] = new JU.BS() : bsExcluded[2]); +this.bsExcludedTriangles = (bsExcluded[3] == null ? bsExcluded[3] = new JU.BS() : bsExcluded[3]); +this.mode = (volumeData.getVoxelData() != null || volumeData.mappingPlane != null ? 1 : bsVoxels != null ? 2 : 3); +this.setParameters(volumeData, params); +}, "J.jvxl.api.VertexDataServer,J.jvxl.data.VolumeData,J.jvxl.readers.Parameters,JU.BS"); +Clazz.defineMethod(c$, "setParameters", +function(volumeData, params){ +this.volumeData = volumeData; +this.colorDensity = params.colorDensity; +this.isContoured = params.thePlane == null && params.isContoured && !this.colorDensity; +this.cutoff = params.cutoff; +this.isCutoffAbsolute = params.isCutoffAbsolute; +this.isDensityRange = (params.cutoffRange != null); +this.contourType = params.contourType; +this.isSquared = params.isSquared; +this.isXLowToHigh = params.isXLowToHigh; +this.cubeCountX = volumeData.voxelCounts[0] - 1; +this.cubeCountY = volumeData.voxelCounts[1] - 1; +this.cubeCountZ = volumeData.voxelCounts[2] - 1; +volumeData.getYzCount(); +if (params.mapLattice != null) { +this.cubeCountX *= Math.abs(params.mapLattice.x); +this.cubeCountY *= Math.abs(params.mapLattice.y); +this.cubeCountZ *= Math.abs(params.mapLattice.z); +}this.nY = this.cubeCountY + 1; +this.nZ = this.cubeCountZ + 1; +this.yzCount = this.nY * this.nZ; +if (this.bsVoxels == null) this.bsVoxels = new JU.BS(); +this.edgeVertexPointers = (this.isXLowToHigh ? J.jvxl.calc.MarchingCubes.edgeVertexPointersLowToHigh : J.jvxl.calc.MarchingCubes.edgeVertexPointersHighToLow); +this.edgeVertexPlanes = (this.isXLowToHigh ? J.jvxl.calc.MarchingCubes.edgeVertexPlanesLowToHigh : J.jvxl.calc.MarchingCubes.edgeVertexPlanesHighToLow); +this.isoPointIndexPlanes = Clazz.newIntArray (2, this.yzCount, 3, 0); +this.yzPlanes = (this.mode == 3 ? Clazz.newFloatArray (2, this.yzCount, 0) : null); +this.setLinearOffsets(); +this.calcVoxelVertexVectors(); +}, "J.jvxl.data.VolumeData,J.jvxl.readers.Parameters"); +Clazz.defineMethod(c$, "calcVoxelVertexVectors", +function(){ +for (var i = 8; --i >= 0; ) this.volumeData.transform(J.jvxl.calc.MarchingCubes.cubeVertexVectors[i], this.voxelVertexVectors[i] = new JU.V3()); + +for (var i = 12; --i >= 0; ) this.edgeVectors[i].sub2(this.voxelVertexVectors[JU.TriangleData.edgeVertexes[i + i + 1]], this.voxelVertexVectors[JU.TriangleData.edgeVertexes[i + i]]); + +}); +Clazz.defineMethod(c$, "resetIndexPlane", +function(plane){ +for (var i = 0; i < this.yzCount; i++) for (var j = 0; j < 3; j++) plane[i][j] = -2147483648; + + +return plane; +}, "~A"); +Clazz.defineMethod(c$, "getEdgeData", +function(){ +if (this.cubeCountX < 0 || this.cubeCountY < 0 || this.cubeCountZ < 0) return ""; +this.mappingPlane = this.volumeData.mappingPlane; +this.edgeCount = 0; +var x0; +var x1; +var xStep; +var ptStep; +var pt; +var ptX; +if (this.isXLowToHigh) { +x0 = 0; +x1 = this.cubeCountX + (this.colorDensity ? 1 : 0); +if (this.colorDensity) { +x1 = this.cubeCountX + 1; +ptX = this.yzCount - 1; +} else { +x1 = this.cubeCountX; +ptX = (this.yzCount - 1) - this.nZ - 1; +}xStep = 1; +ptStep = this.yzCount; +} else { +if (this.colorDensity) { +x0 = this.cubeCountX; +ptX = (this.cubeCountX + 1) * this.yzCount - 1; +} else { +x0 = this.cubeCountX - 1; +ptX = (this.cubeCountX * this.yzCount - 1) - this.nZ - 1; +}x1 = -1; +xStep = -1; +ptStep = -this.yzCount; +}pt = ptX; +this.resetIndexPlane(this.isoPointIndexPlanes[1]); +this.voxelData = null; +var y1 = this.cubeCountY + (this.colorDensity ? 1 : 0); +var z1 = this.cubeCountZ + (this.colorDensity ? 1 : 0); +switch (this.mode) { +case 3: +this.getPlane(x0, false); +break; +case 1: +this.voxelData = this.volumeData.getVoxelData(); +break; +} +this.allInside = (this.colorDensity && (this.cutoff == 0 || this.mode == 2 && this.bsVoxels.nextSetBit(0) < 0)); +var colorDensityAll = (this.colorDensity && this.cutoff == 0); +var v = 0; +for (var x = x0; x != x1; x += xStep, ptX += ptStep, pt = ptX) { +if (this.mode == 3) { +if (x + xStep <= x1) this.getPlane(x + xStep, true); +}if (this.bsExcludedPlanes.get(x) && this.bsExcludedPlanes.get(x + xStep)) continue; +if (this.colorDensity) { +for (var y = y1; --y >= 0; ) for (var z = z1; --z >= 0; pt--) { +v = this.getValue(x, y, z, pt, 0); +if (colorDensityAll || this.$isInside) { +this.addVertex(x, y, z, pt, v); +}} + +continue; +}var indexPlane = this.isoPointIndexPlanes[0]; +this.isoPointIndexPlanes[0] = this.isoPointIndexPlanes[1]; +this.isoPointIndexPlanes[1] = this.resetIndexPlane(indexPlane); +var noValues = true; +for (var y = y1; --y >= 0; pt--) { +for (var z = z1; --z >= 0; pt--) { +var insideMask = 0; +for (var i = 8; --i >= 0; ) { +v = this.getValue(x, y, z, pt, i); +if (this.$isInside) insideMask |= JU.TriangleData.Pwr2[i]; +} +if (noValues && !Float.isNaN(v)) noValues = false; +if (insideMask == 0) { +continue; +}if (insideMask == 0xFF) { +continue; +}if (this.processOneCubical(insideMask, x, y, z, pt) && !this.isContoured && !this.colorDensity) { +this.processTriangles(insideMask); +}} +} +if (noValues) { +this.bsExcludedPlanes.set(x); +}} +return this.edgeData.toString(); +}); +Clazz.defineMethod(c$, "getValue", +function(x, y, z, pt, i){ +var v; +this.offset = JU.TriangleData.cubeVertexOffsets[i]; +var pti = pt + this.linearOffsets[i]; +switch (this.mode) { +case 3: +v = this.vertexValues[i] = this.getValueArray(x + this.offset.x, y + this.offset.y, z + this.offset.z, pti, this.yzPlanes[J.jvxl.calc.MarchingCubes.yzPlanePts[i]]); +this.$isInside = (this.allInside || this.bsVoxels.get(pti)); +break; +case 2: +this.$isInside = (this.allInside || this.bsVoxels.get(pti)); +v = this.vertexValues[i] = ((this.isDensityRange ? !this.$isInside : this.bsExcludedVertices.get(pti)) ? NaN : this.$isInside ? 1 : 0); +break; +default: +case 1: +if (this.mappingPlane == null) { +v = this.vertexValues[i] = this.voxelData[x + this.offset.x][y + this.offset.y][z + this.offset.z]; +} else { +this.volumeData.voxelPtToXYZ(x + this.offset.x, y + this.offset.y, z + this.offset.z, this.pt0); +v = this.vertexValues[i] = this.volumeData.distanceToMappingPlane(this.pt0); +}if (this.isSquared) this.vertexValues[i] *= this.vertexValues[i]; +this.$isInside = (this.allInside ? true : J.jvxl.calc.MarchingCubes.isInside(this.vertexValues[i], this.cutoff, this.isCutoffAbsolute)); +if (this.$isInside) this.bsVoxels.set(pti); +} +return v; +}, "~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "getPlane", +function(i, andSwap){ +if (i < 0 || i > this.cubeCountX) return; +this.surfaceReader.getPlane(i); +if (andSwap) { +var plane = this.yzPlanes[0]; +this.yzPlanes[0] = this.yzPlanes[1]; +this.yzPlanes[1] = plane; +}}, "~N,~B"); +Clazz.defineMethod(c$, "processTriangles", +function(insideMask){ +var triangles = JU.TriangleData.triangleTable2[insideMask]; +for (var i = triangles.length; (i -= 4) >= 0; ) this.addTriangle(triangles[i], triangles[i + 1], triangles[i + 2], triangles[i + 3]); + +}, "~N"); +Clazz.defineMethod(c$, "addVertex", +function(x, y, z, pti, value){ +this.volumeData.voxelPtToXYZ(x, y, z, this.pt0); +if (this.surfaceReader.addVertexCopy(this.pt0, value, -4, true) < 0) this.bsExcludedVertices.set(pti); +}, "~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "addTriangle", +function(ia, ib, ic, edgeType){ +if (!this.bsExcludedTriangles.get(this.nTriangles) && this.surfaceReader.addTriangleCheck(this.edgePointIndexes[ia], this.edgePointIndexes[ib], this.edgePointIndexes[ic], edgeType, 0, this.isCutoffAbsolute, 0) < 0) { +this.bsExcludedTriangles.set(this.nTriangles); +}this.nTriangles++; +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "getValueArray", +function(x, y, z, pt, tempValues){ +var ptyz = pt % this.yzCount; +this.bsValues.set(pt); +var value = this.surfaceReader.getValue(x, y, z, ptyz); +if (this.isSquared) value *= value; +tempValues[ptyz] = value; +if (J.jvxl.calc.MarchingCubes.isInside(value, this.cutoff, this.isCutoffAbsolute)) this.bsVoxels.set(pt); +return value; +}, "~N,~N,~N,~N,~A"); +c$.isInside = Clazz.defineMethod(c$, "isInside", +function(voxelValue, max, isAbsolute){ +return ((max > 0 && (isAbsolute ? Math.abs(voxelValue) : voxelValue) >= max) || (max <= 0 && voxelValue <= max)); +}, "~N,~N,~B"); +Clazz.defineMethod(c$, "processOneCubical", +function(insideMask, x, y, z, pt){ +var edgeMask = J.jvxl.calc.MarchingCubes.insideMaskTable[insideMask]; +var isNaN = false; +for (var iEdge = 12; --iEdge >= 0; ) { +var xEdge = JU.TriangleData.Pwr2[iEdge]; +if ((edgeMask & xEdge) == 0) continue; +var iPlane = this.edgeVertexPlanes[iEdge]; +var iPt = (pt + this.linearOffsets[this.edgeVertexPointers[iEdge]]) % this.yzCount; +var iType = J.jvxl.calc.MarchingCubes.edgeTypeTable[iEdge]; +var index = this.edgePointIndexes[iEdge] = this.isoPointIndexPlanes[iPlane][iPt][iType]; +if (index != -2147483648) { +if (index == -1) isNaN = this.excludePartialCubes; +continue; +}var vertexA = JU.TriangleData.edgeVertexes[iEdge << 1]; +var vertexB = JU.TriangleData.edgeVertexes[(iEdge << 1) + 1]; +var valueA = this.vertexValues[vertexA]; +var valueB = this.vertexValues[vertexB]; +this.calcVertexPoint(x, y, z, vertexA, this.pointA); +this.edgeCount++; +var i = this.edgePointIndexes[iEdge] = this.isoPointIndexPlanes[iPlane][iPt][iType] = this.surfaceReader.getSurfacePointIndexAndFraction(this.cutoff, this.isCutoffAbsolute, x, y, z, JU.TriangleData.cubeVertexOffsets[vertexA], vertexA, vertexB, valueA, valueB, this.pointA, this.edgeVectors[iEdge], iType == this.contourType, this.fReturn); +this.addEdgeData(i < 0 ? NaN : this.fReturn[0]); +if (Float.isNaN(this.fReturn[0]) || i < 0) isNaN = this.excludePartialCubes; +} +return !isNaN; +}, "~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "addEdgeData", +function(f){ +var ch = J.jvxl.data.JvxlCoder.jvxlFractionAsCharacter(f); +this.edgeData.appendC(ch); +}, "~N"); +Clazz.defineMethod(c$, "calcVertexPoint", +function(x, y, z, vertex, pt){ +this.volumeData.voxelPtToXYZ(x, y, z, this.pt0); +pt.add2(this.pt0, this.voxelVertexVectors[vertex]); +}, "~N,~N,~N,~N,JU.P3"); +Clazz.defineMethod(c$, "setLinearOffsets", +function(){ +this.linearOffsets[0] = 0; +this.linearOffsets[1] = this.yzCount; +this.linearOffsets[2] = this.yzCount + 1; +this.linearOffsets[3] = 1; +this.linearOffsets[4] = this.nZ; +this.linearOffsets[5] = this.yzCount + this.nZ; +this.linearOffsets[6] = this.yzCount + this.nZ + 1; +this.linearOffsets[7] = this.nZ + 1; +}); +Clazz.defineMethod(c$, "getLinearOffset", +function(x, y, z, offset){ +return x * this.yzCount + y * this.nZ + z + this.linearOffsets[offset]; +}, "~N,~N,~N,~N"); +c$.yzPlanePts = Clazz.newIntArray(-1, [0, 1, 1, 0, 0, 1, 1, 0]); +c$.edgeVertexPointersLowToHigh = Clazz.newIntArray(-1, [1, 1, 2, 0, 5, 5, 6, 4, 0, 1, 2, 3]); +c$.edgeVertexPointersHighToLow = Clazz.newIntArray(-1, [0, 1, 3, 0, 4, 5, 7, 4, 0, 1, 2, 3]); +c$.edgeVertexPlanesLowToHigh = Clazz.newIntArray(-1, [1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0]); +c$.edgeVertexPlanesHighToLow = Clazz.newIntArray(-1, [1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1]); +c$.cubeVertexVectors = Clazz.newArray(-1, [JU.V3.new3(0, 0, 0), JU.V3.new3(1, 0, 0), JU.V3.new3(1, 0, 1), JU.V3.new3(0, 0, 1), JU.V3.new3(0, 1, 0), JU.V3.new3(1, 1, 0), JU.V3.new3(1, 1, 1), JU.V3.new3(0, 1, 1)]); +c$.edgeTypeTable = Clazz.newIntArray(-1, [0, 2, 0, 2, 0, 2, 0, 2, 1, 1, 1, 1]); +c$.insideMaskTable = Clazz.newShortArray(-1, [0x0000, 0x0109, 0x0203, 0x030A, 0x0406, 0x050F, 0x0605, 0x070C, 0x080C, 0x0905, 0x0A0F, 0x0B06, 0x0C0A, 0x0D03, 0x0E09, 0x0F00, 0x0190, 0x0099, 0x0393, 0x029A, 0x0596, 0x049F, 0x0795, 0x069C, 0x099C, 0x0895, 0x0B9F, 0x0A96, 0x0D9A, 0x0C93, 0x0F99, 0x0E90, 0x0230, 0x0339, 0x0033, 0x013A, 0x0636, 0x073F, 0x0435, 0x053C, 0x0A3C, 0x0B35, 0x083F, 0x0936, 0x0E3A, 0x0F33, 0x0C39, 0x0D30, 0x03A0, 0x02A9, 0x01A3, 0x00AA, 0x07A6, 0x06AF, 0x05A5, 0x04AC, 0x0BAC, 0x0AA5, 0x09AF, 0x08A6, 0x0FAA, 0x0EA3, 0x0DA9, 0x0CA0, 0x0460, 0x0569, 0x0663, 0x076A, 0x0066, 0x016F, 0x0265, 0x036C, 0x0C6C, 0x0D65, 0x0E6F, 0x0F66, 0x086A, 0x0963, 0x0A69, 0x0B60, 0x05F0, 0x04F9, 0x07F3, 0x06FA, 0x01F6, 0x00FF, 0x03F5, 0x02FC, 0x0DFC, 0x0CF5, 0x0FFF, 0x0EF6, 0x09FA, 0x08F3, 0x0BF9, 0x0AF0, 0x0650, 0x0759, 0x0453, 0x055A, 0x0256, 0x035F, 0x0055, 0x015C, 0x0E5C, 0x0F55, 0x0C5F, 0x0D56, 0x0A5A, 0x0B53, 0x0859, 0x0950, 0x07C0, 0x06C9, 0x05C3, 0x04CA, 0x03C6, 0x02CF, 0x01C5, 0x00CC, 0x0FCC, 0x0EC5, 0x0DCF, 0x0CC6, 0x0BCA, 0x0AC3, 0x09C9, 0x08C0, 0x08C0, 0x09C9, 0x0AC3, 0x0BCA, 0x0CC6, 0x0DCF, 0x0EC5, 0x0FCC, 0x00CC, 0x01C5, 0x02CF, 0x03C6, 0x04CA, 0x05C3, 0x06C9, 0x07C0, 0x0950, 0x0859, 0x0B53, 0x0A5A, 0x0D56, 0x0C5F, 0x0F55, 0x0E5C, 0x015C, 0x0055, 0x035F, 0x0256, 0x055A, 0x0453, 0x0759, 0x0650, 0x0AF0, 0x0BF9, 0x08F3, 0x09FA, 0x0EF6, 0x0FFF, 0x0CF5, 0x0DFC, 0x02FC, 0x03F5, 0x00FF, 0x01F6, 0x06FA, 0x07F3, 0x04F9, 0x05F0, 0x0B60, 0x0A69, 0x0963, 0x086A, 0x0F66, 0x0E6F, 0x0D65, 0x0C6C, 0x036C, 0x0265, 0x016F, 0x0066, 0x076A, 0x0663, 0x0569, 0x0460, 0x0CA0, 0x0DA9, 0x0EA3, 0x0FAA, 0x08A6, 0x09AF, 0x0AA5, 0x0BAC, 0x04AC, 0x05A5, 0x06AF, 0x07A6, 0x00AA, 0x01A3, 0x02A9, 0x03A0, 0x0D30, 0x0C39, 0x0F33, 0x0E3A, 0x0936, 0x083F, 0x0B35, 0x0A3C, 0x053C, 0x0435, 0x073F, 0x0636, 0x013A, 0x0033, 0x0339, 0x0230, 0x0E90, 0x0F99, 0x0C93, 0x0D9A, 0x0A96, 0x0B9F, 0x0895, 0x099C, 0x069C, 0x0795, 0x049F, 0x0596, 0x029A, 0x0393, 0x0099, 0x0190, 0x0F00, 0x0E09, 0x0D03, 0x0C0A, 0x0B06, 0x0A0F, 0x0905, 0x080C, 0x070C, 0x0605, 0x050F, 0x0406, 0x030A, 0x0203, 0x0109, 0x0000]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/calc/MarchingSquares.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/calc/MarchingSquares.js new file mode 100755 index 000000000000..6540033afc09 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/calc/MarchingSquares.js @@ -0,0 +1,241 @@ +Clazz.declarePackage("J.jvxl.calc"); +Clazz.load(["JU.P3", "java.util.Hashtable"], "J.jvxl.calc.MarchingSquares", ["JU.AU", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.surfaceReader = null; +this.volumeData = null; +this.nContourSegments = 0; +this.contourType = 0; +this.thisContour = 0; +this.valueMin = 0; +this.valueMax = 0; +this.pointA = null; +this.pointB = null; +this.contourFromZero = true; +this.contoursDiscrete = null; +this.contourVertexCount = 0; +this.contourVertexes = null; +if (!Clazz.isClassDefined("J.jvxl.calc.MarchingSquares.ContourVertex")) { +J.jvxl.calc.MarchingSquares.$MarchingSquares$ContourVertex$ (); +} +this.contourPlaneMinimumValue = 0; +this.contourPlaneMaximumValue = 0; +this.contourValuesUsed = null; +this.ptTemp = null; +this.triangleCount = 0; +this.triangles = null; +this.htPts = null; +if (!Clazz.isClassDefined("J.jvxl.calc.MarchingSquares.Triangle")) { +J.jvxl.calc.MarchingSquares.$MarchingSquares$Triangle$ (); +} +Clazz.instantialize(this, arguments);}, J.jvxl.calc, "MarchingSquares", null); +Clazz.prepareFields (c$, function(){ +this.pointA = new JU.P3(); +this.pointB = new JU.P3(); +this.contourVertexes = new Array(1000); +this.ptTemp = new JU.P3(); +this.triangles = new Array(1000); +this.htPts = new java.util.Hashtable(); +}); +Clazz.makeConstructor(c$, +function(surfaceReader, volumeData, thePlane, contoursDiscrete, nContours, thisContour, contourFromZero){ +this.surfaceReader = surfaceReader; +this.volumeData = volumeData; +this.thisContour = thisContour; +this.contoursDiscrete = contoursDiscrete; +this.contourFromZero = contourFromZero; +if (contoursDiscrete == null) { +var i = 0; +this.nContourSegments = (nContours == 0 ? 9 : nContours) + i; +if (this.nContourSegments > 100) this.nContourSegments = 100; +} else { +nContours = contoursDiscrete.length; +this.nContourSegments = nContours; +this.contourFromZero = false; +}}, "J.jvxl.api.VertexDataServer,J.jvxl.data.VolumeData,JU.P4,~A,~N,~N,~B"); +Clazz.defineMethod(c$, "setMinMax", +function(valueMin, valueMax){ +this.valueMin = valueMin; +this.valueMax = valueMax; +}, "~N,~N"); +Clazz.defineMethod(c$, "addContourVertex", +function(vertexXYZ, value){ +if (this.contourVertexCount == this.contourVertexes.length) this.contourVertexes = JU.AU.doubleLength(this.contourVertexes); +var vPt = this.surfaceReader.addVertexCopy(vertexXYZ, value, -2, true); +this.contourVertexes[this.contourVertexCount++] = Clazz.innerTypeInstance(J.jvxl.calc.MarchingSquares.ContourVertex, this, null, vertexXYZ); +return vPt; +}, "JU.P3,~N"); +Clazz.defineMethod(c$, "setContourData", +function(i, value){ +this.contourVertexes[i].setValue(value); +}, "~N,~N"); +Clazz.defineMethod(c$, "calcContourPoint", +function(cutoff, valueA, valueB, pt){ +return this.volumeData.calculateFractionalPoint(cutoff, this.pointA, this.pointB, valueA, valueB, pt); +}, "~N,~N,~N,JU.P3"); +Clazz.defineMethod(c$, "addTriangle", +function(iA, iB, iC, check, iContour){ +if (this.triangleCount == this.triangles.length) this.triangles = JU.AU.doubleLength(this.triangles); +this.triangles[this.triangleCount++] = Clazz.innerTypeInstance(J.jvxl.calc.MarchingSquares.Triangle, this, null, iA, iB, iC, check, iContour); +return 0; +}, "~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "generateContourData", +function(haveData, zeroOffset){ +JU.Logger.info("generateContours: " + this.nContourSegments + " segments"); +this.getVertexValues(haveData); +this.createContours(this.valueMin, this.valueMax, zeroOffset); +this.addAllTriangles(); +return this.contourVertexCount; +}, "~B,~N"); +Clazz.defineMethod(c$, "getVertexValues", +function(haveData){ +this.contourPlaneMinimumValue = 3.4028235E38; +this.contourPlaneMaximumValue = -3.4028235E38; +for (var i = 0; i < this.contourVertexCount; i++) { +var c = this.contourVertexes[i]; +var value; +if (haveData) { +value = c.value; +} else { +value = this.volumeData.lookupInterpolatedVoxelValue(c, false); +c.setValue(value); +}if (value < this.contourPlaneMinimumValue) this.contourPlaneMinimumValue = value; +if (value > this.contourPlaneMaximumValue) this.contourPlaneMaximumValue = value; +} +}, "~B"); +Clazz.defineMethod(c$, "createContours", +function(min, max, zeroOffset){ +var diff = max - min; +this.contourValuesUsed = Clazz.newFloatArray (this.nContourSegments, 0); +for (var i = this.triangleCount; --i >= 0; ) this.triangles[i].check = 0; + +var minCutoff = -3.4028235E38; +var cutoff = minCutoff; +for (var i = 0; i < this.nContourSegments; i++) { +cutoff = (this.contoursDiscrete != null ? this.contoursDiscrete[i] : this.contourFromZero ? min + (i * 1 / this.nContourSegments) * diff : i == 0 ? -3.4028235E38 : i == this.nContourSegments - 1 ? 3.4028235E38 : min + ((i - 1) * 1 / (this.nContourSegments - 1)) * diff); +if (this.contoursDiscrete == null && Math.abs(cutoff) < zeroOffset) cutoff = (cutoff < 0 ? -zeroOffset : zeroOffset); +this.contourValuesUsed[i] = cutoff; +JU.Logger.info("#contour " + (i + 1) + " " + cutoff + " " + this.triangleCount); +this.htPts.clear(); +for (var ii = this.triangleCount; --ii >= 0; ) { +if (this.triangles[ii].isValid) this.checkContour(this.triangles[ii], i, cutoff); +} +if (this.thisContour > 0) { +if (i + 1 == this.thisContour) minCutoff = cutoff; +} else { +}} +if (this.contoursDiscrete != null) { +minCutoff = this.contoursDiscrete[0]; +}this.valueMin = this.contourValuesUsed[0]; +this.valueMax = (this.contourValuesUsed.length == 0 ? this.valueMin : this.contourValuesUsed[this.contourValuesUsed.length - 1]); +return true; +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "intercept", +function(t, i, value){ +var iA = t.pts[i]; +var iB = t.pts[(i + 1) % 3]; +if (iA == 2147483647 || iB == 2147483647) return -1; +var key = (iA < iB ? iA + "_" + iB : iB + "_" + iA); +if (this.htPts.containsKey(key)) return this.htPts.get(key).intValue(); +var valueA = this.contourVertexes[iA].value; +var valueB = this.contourVertexes[iB].value; +var iPt = -1; +if (valueA != valueB) { +var f = (value - valueA) / (valueB - valueA); +if (f >= 0 && f <= 1) { +this.pointA.setT(this.contourVertexes[iA]); +this.pointB.setT(this.contourVertexes[iB]); +value = this.calcContourPoint(value, valueA, valueB, this.ptTemp); +if (!Float.isNaN(value)) { +iPt = this.addContourVertex(this.ptTemp, value); +if (iPt < 0) return -1; +this.contourVertexes[iPt].setValue(value); +} else { +}}}this.htPts.put(key, Integer.$valueOf(iPt)); +return iPt; +}, "J.jvxl.calc.MarchingSquares.Triangle,~N,~N"); +Clazz.defineMethod(c$, "checkContour", +function(t, i, value){ +if (this.thisContour > 0 && i + 1 != this.thisContour) return; +var ipt0 = this.intercept(t, 0, value); +var ipt1 = this.intercept(t, 1, value); +var ipt2 = this.intercept(t, 2, value); +var pts = t.pts; +var mode = 0; +if (ipt0 >= 0) { +mode += 1; +}if (ipt1 >= 0) { +mode += 2; +}if (ipt2 >= 0) { +mode += 4; +}switch (mode) { +case 3: +this.addTriangle(pts[0], ipt0, ipt1, 2 | (t.check & 1), i); +this.addTriangle(ipt0, pts[1], ipt1, 4 | (t.check & 3), i); +this.addTriangle(pts[0], ipt1, pts[2], (t.check & 6), i); +break; +case 5: +this.addTriangle(pts[0], ipt0, ipt2, 2 | (t.check & 5), i); +this.addTriangle(ipt0, pts[1], ipt2, 4 | (t.check & 1), i); +this.addTriangle(ipt2, pts[1], pts[2], (t.check & 6), i); +break; +case 6: +this.addTriangle(pts[0], pts[1], ipt2, (t.check & 5), i); +this.addTriangle(ipt2, pts[1], ipt1, 4 | (t.check & 2), i); +this.addTriangle(ipt2, ipt1, pts[2], 1 | (t.check & 6), i); +break; +default: +return; +} +t.isValid = false; +}, "J.jvxl.calc.MarchingSquares.Triangle,~N,~N"); +Clazz.defineMethod(c$, "getMinMax", +function(){ +return Clazz.newFloatArray(-1, [this.valueMin, this.valueMax]); +}); +Clazz.defineMethod(c$, "addAllTriangles", +function(){ +for (var i = 0; i < this.triangleCount; i++) if (this.triangles[i].isValid) { +var t = this.triangles[i]; +this.surfaceReader.addTriangleCheck(t.pts[0], t.pts[1], t.pts[2], t.check, t.contourIndex, false, -1); +} +}); +c$.$MarchingSquares$ContourVertex$ = function(){ +/*if4*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +Clazz.prepareCallback(this, arguments); +this.value = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.calc.MarchingSquares, "ContourVertex", JU.P3); +Clazz.makeConstructor(c$, +function(vertexXYZ){ +Clazz.superConstructor (this, J.jvxl.calc.MarchingSquares.ContourVertex, []); +this.setT(vertexXYZ); +}, "JU.P3"); +Clazz.defineMethod(c$, "setValue", +function(value){ +this.value = value; +}, "~N"); +Clazz.overrideMethod(c$, "toString", +function(){ +return this.value + " " + this.x + " " + this.y + " " + this.z; +}); +/*eoif4*/})(); +}; +c$.$MarchingSquares$Triangle$ = function(){ +/*if4*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +Clazz.prepareCallback(this, arguments); +this.pts = null; +this.check = 0; +this.isValid = true; +this.contourIndex = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.calc.MarchingSquares, "Triangle", null); +Clazz.makeConstructor(c$, +function(iA, iB, iC, check, contourIndex){ +this.pts = Clazz.newIntArray(-1, [iA, iB, iC]); +this.check = check; +this.contourIndex = contourIndex; +}, "~N,~N,~N,~N,~N"); +/*eoif4*/})(); +}; +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/data/JvxlCoder.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/data/JvxlCoder.js new file mode 100755 index 000000000000..aa084a0b5a48 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/data/JvxlCoder.js @@ -0,0 +1,698 @@ +Clazz.declarePackage("J.jvxl.data"); +Clazz.load(null, "J.jvxl.data.JvxlCoder", ["JU.BS", "$.Lst", "$.P3", "$.PT", "$.SB", "J.api.Interface", "J.jvxl.data.VolumeData", "JU.BSUtil", "$.C", "$.Escape", "$.Logger", "JV.Viewer"], function(){ +var c$ = Clazz.declareType(J.jvxl.data, "JvxlCoder", null); +c$.jvxlGetFile = Clazz.defineMethod(c$, "jvxlGetFile", +function(jvxlData, meshData, title, msg, includeHeader, nSurfaces, state, comment){ +J.jvxl.data.JvxlCoder.checkHaveXMLUtil(); +var data = new JU.SB(); +if ("TRAILERONLY".equals(msg)) { +JU.XmlUtil.closeTag(data, "jvxlSurfaceSet"); +JU.XmlUtil.closeTag(data, "jvxl"); +return data.toString(); +}var vertexDataOnly = (meshData != null); +var isHeaderOnly = ("HEADERONLY".equals(msg)); +if (includeHeader) { +JU.XmlUtil.openDocument(data); +JU.XmlUtil.openTagAttr(data, "jvxl", Clazz.newArray(-1, ["version", "2.4", "jmolVersion", jvxlData.version, "xmlns", "http://jmol.org/jvxl_schema", "xmlns:cml", "http://www.xml-cml.org/schema"])); +JU.XmlUtil.appendCdata(data, "jvxlFileTitle", null, jvxlData.jvxlFileTitle == null ? "\n" : "\n" + jvxlData.jvxlFileTitle); +if (jvxlData.moleculeXml != null) data.append(jvxlData.moleculeXml); +var volumeDataXml = (vertexDataOnly ? null : jvxlData.jvxlVolumeDataXml); +if (volumeDataXml == null) volumeDataXml = ( new J.jvxl.data.VolumeData()).setVolumetricXml(); +data.append(volumeDataXml); +JU.XmlUtil.openTagAttr(data, "jvxlSurfaceSet", Clazz.newArray(-1, ["count", "" + (nSurfaces > 0 ? nSurfaces : 1)])); +if (isHeaderOnly) return data.toString(); +}var sb; +var type = (vertexDataOnly ? "pmesh" : jvxlData.jvxlPlane == null ? "isosurface" : "plane"); +if (jvxlData.jvxlColorData != null && jvxlData.jvxlColorData.length > 0) type = "mapped " + type; +JU.XmlUtil.openTagAttr(data, "jvxlSurface", Clazz.newArray(-1, ["type", type])); +data.append(J.jvxl.data.JvxlCoder.jvxlGetInfoData(jvxlData, vertexDataOnly)); +J.jvxl.data.JvxlCoder.jvxlAppendCommandState(data, comment, state); +if (title != null || msg != null && msg.length > 0) { +sb = new JU.SB(); +if (msg != null && msg.length > 0) sb.append(msg).append("\n"); +if (title != null) for (var i = 0; i < title.length; i++) sb.append(title[i]).appendC('\n'); + +JU.XmlUtil.appendCdata(data, "jvxlSurfaceTitle", null, sb.toString()); +}sb = new JU.SB(); +JU.XmlUtil.openTagAttr(sb, "jvxlSurfaceData", (vertexDataOnly || jvxlData.jvxlPlane == null ? null : jvxlData.mapLattice == null ? Clazz.newArray(-1, ["plane", JU.Escape.eP4(jvxlData.jvxlPlane)]) : Clazz.newArray(-1, ["plane", JU.Escape.eP4(jvxlData.jvxlPlane), "maplattice", JU.Escape.eP(jvxlData.mapLattice)]))); +if (vertexDataOnly) { +J.jvxl.data.JvxlCoder.appendXmlVertexOnlyData(sb, jvxlData, meshData, true); +} else if (jvxlData.jvxlPlane == null) { +if (jvxlData.jvxlEdgeData == null) return ""; +J.jvxl.data.JvxlCoder.appendXmlEdgeData(sb, jvxlData); +J.jvxl.data.JvxlCoder.appendXmlColorData(sb, jvxlData.jvxlColorData, true, jvxlData.isJvxlPrecisionColor, jvxlData.valueMappedToRed, jvxlData.valueMappedToBlue); +} else { +J.jvxl.data.JvxlCoder.appendXmlColorData(sb, jvxlData.jvxlColorData, true, jvxlData.isJvxlPrecisionColor, jvxlData.valueMappedToRed, jvxlData.valueMappedToBlue); +}J.jvxl.data.JvxlCoder.appendEncodedBitSetTag(sb, "jvxlInvalidatedVertexData", jvxlData.jvxlExcluded[1], -1, null); +if (jvxlData.excludedVertexCount > 0) { +J.jvxl.data.JvxlCoder.appendEncodedBitSetTag(sb, "jvxlExcludedVertexData", jvxlData.jvxlExcluded[0], jvxlData.excludedVertexCount, null); +J.jvxl.data.JvxlCoder.appendEncodedBitSetTag(sb, "jvxlExcludedPlaneData", jvxlData.jvxlExcluded[2], -1, null); +}J.jvxl.data.JvxlCoder.appendEncodedBitSetTag(sb, "jvxlExcludedTriangleData", jvxlData.jvxlExcluded[3], jvxlData.excludedTriangleCount, null); +JU.XmlUtil.closeTag(sb, "jvxlSurfaceData"); +var len = sb.length(); +data.appendSB(sb); +if (jvxlData.vContours != null && jvxlData.vContours.length > 0) { +J.jvxl.data.JvxlCoder.jvxlEncodeContourData(jvxlData.vContours, data); +}if (jvxlData.vertexColorMap != null) { +if (jvxlData.baseColor == null) JU.XmlUtil.openTag(data, "jvxlVertexColorData"); + else JU.XmlUtil.openTagAttr(data, "jvxlVertexColorData", Clazz.newArray(-1, ["baseColor", jvxlData.baseColor])); +for (var entry, $entry = jvxlData.vertexColorMap.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) J.jvxl.data.JvxlCoder.appendEncodedBitSetTag(data, "jvxlColorMap", entry.getValue(), -1, Clazz.newArray(-1, ["color", entry.getKey()])); + +jvxlData.vertexColorMap = null; +JU.XmlUtil.closeTag(data, "jvxlVertexColorData"); +}JU.XmlUtil.closeTag(data, "jvxlSurface"); +if (includeHeader) { +JU.XmlUtil.closeTag(data, "jvxlSurfaceSet"); +JU.XmlUtil.closeTag(data, "jvxl"); +}return J.jvxl.data.JvxlCoder.jvxlSetCompressionRatio(data, jvxlData, len); +}, "J.jvxl.data.JvxlData,J.jvxl.data.MeshData,~A,~S,~B,~N,~S,~S"); +c$.checkHaveXMLUtil = Clazz.defineMethod(c$, "checkHaveXMLUtil", +function(){ +if (!J.jvxl.data.JvxlCoder.haveXMLUtil) { +if (JV.Viewer.isJS) J.api.Interface.getInterface("JU.XmlUtil", null, "show"); +J.jvxl.data.JvxlCoder.haveXMLUtil = true; +}}); +c$.appendEncodedBitSetTag = Clazz.defineMethod(c$, "appendEncodedBitSetTag", +function(sb, name, bs, count, attribs){ +if (count < 0) count = JU.BSUtil.cardinalityOf(bs); +if (count == 0) return; +var sb1 = new JU.SB(); +sb1.append("\n "); +J.jvxl.data.JvxlCoder.jvxlEncodeBitSetBuffer(bs, -1, sb1); +JU.XmlUtil.appendTagObj(sb, name, Clazz.newArray(-1, [attribs, "bsEncoding", "base90+35", "count", "" + count, "len", "" + bs.length()]), J.jvxl.data.JvxlCoder.jvxlCompressString(sb1.toString(), true)); +}, "JU.SB,~S,JU.BS,~N,~A"); +c$.jvxlSetCompressionRatio = Clazz.defineMethod(c$, "jvxlSetCompressionRatio", +function(data, jvxlData, len){ +var s = data.toString(); +var r = Clazz.floatToInt(jvxlData.nBytes > 0 ? (jvxlData.nBytes) / len : ((jvxlData.nPointsX * jvxlData.nPointsY * jvxlData.nPointsZ * 13)) / len); +return JU.PT.rep(s, "\"not calculated\"", (r > 0 ? "\"" + r + ":1\"" : "\"?\"")); +}, "JU.SB,J.jvxl.data.JvxlData,~N"); +c$.appendXmlEdgeData = Clazz.defineMethod(c$, "appendXmlEdgeData", +function(sb, jvxlData){ +JU.XmlUtil.appendTagObj(sb, "jvxlEdgeData", Clazz.newArray(-1, ["count", "" + (jvxlData.jvxlEdgeData.length - 1), "encoding", "base90f1", "bsEncoding", "base90+35c", "isXLowToHigh", "" + jvxlData.isXLowToHigh, "data", J.jvxl.data.JvxlCoder.jvxlCompressString(jvxlData.jvxlEdgeData, true)]), "\n" + J.jvxl.data.JvxlCoder.jvxlCompressString(jvxlData.jvxlSurfaceData, true)); +}, "JU.SB,J.jvxl.data.JvxlData"); +c$.jvxlAppendCommandState = Clazz.defineMethod(c$, "jvxlAppendCommandState", +function(data, cmd, state){ +if (cmd != null) JU.XmlUtil.appendCdata(data, "jvxlIsosurfaceCommand", null, "\n" + (cmd.indexOf("#") < 0 ? cmd : cmd.substring(0, cmd.indexOf("#"))) + "\n"); +if (state != null) { +if (state.indexOf("** XML ** ") >= 0) { +state = JU.PT.split(state, "** XML **")[1].trim(); +JU.XmlUtil.appendTag(data, "jvxlIsosurfaceState", "\n" + state + "\n"); +} else { +JU.XmlUtil.appendCdata(data, "jvxlIsosurfaceState", null, "\n" + state); +}}}, "JU.SB,~S,~S"); +c$.appendXmlColorData = Clazz.defineMethod(c$, "appendXmlColorData", +function(sb, data, isEncoded, isPrecisionColor, value1, value2){ +var n; +if (data == null || (n = data.length - 1) < 0) return; +if (isPrecisionColor) n /= 2; +JU.XmlUtil.appendTagObj(sb, "jvxlColorData", Clazz.newArray(-1, ["count", "" + n, "encoding", (isEncoded ? "base90f" + (isPrecisionColor ? "2" : "1") : "none"), "min", "" + value1, "max", "" + value2, "data", J.jvxl.data.JvxlCoder.jvxlCompressString(data, true)]), null); +}, "JU.SB,~S,~B,~B,~N,~N"); +c$.jvxlGetInfo = Clazz.defineMethod(c$, "jvxlGetInfo", +function(jvxlData){ +return J.jvxl.data.JvxlCoder.jvxlGetInfoData(jvxlData, jvxlData.vertexDataOnly); +}, "J.jvxl.data.JvxlData"); +c$.jvxlGetInfoData = Clazz.defineMethod(c$, "jvxlGetInfoData", +function(jvxlData, vertexDataOnly){ +if (jvxlData.jvxlSurfaceData == null) return ""; +J.jvxl.data.JvxlCoder.checkHaveXMLUtil(); +var attribs = new JU.Lst(); +var nSurfaceInts = jvxlData.nSurfaceInts; +var bytesUncompressedEdgeData = (vertexDataOnly ? 0 : jvxlData.jvxlEdgeData.length - 1); +var nColorData = (jvxlData.jvxlColorData == null ? -1 : (jvxlData.jvxlColorData.length - 1)); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n isModelConnected", "" + jvxlData.isModelConnected); +if (!vertexDataOnly) { +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n cutoff", (jvxlData.cutoffRange == null ? "" + jvxlData.cutoff : jvxlData.cutoffRange[0] + " " + jvxlData.cutoffRange[1])); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n isCutoffAbsolute", "" + jvxlData.isCutoffAbsolute); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n pointsPerAngstrom", "" + jvxlData.pointsPerAngstrom); +var n = jvxlData.jvxlSurfaceData.length + bytesUncompressedEdgeData + nColorData + 1; +if (n > 0) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n nBytesData", "" + n); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n isXLowToHigh", "" + jvxlData.isXLowToHigh); +if (jvxlData.jvxlPlane == null) { +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n nSurfaceInts", "" + nSurfaceInts); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n nBytesUncompressedEdgeData", "" + bytesUncompressedEdgeData); +}if (nColorData > 0) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n nBytesUncompressedColorData", "" + nColorData); +}jvxlData.excludedVertexCount = JU.BSUtil.cardinalityOf(jvxlData.jvxlExcluded[0]); +jvxlData.excludedTriangleCount = JU.BSUtil.cardinalityOf(jvxlData.jvxlExcluded[3]); +if (jvxlData.excludedVertexCount > 0) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n nExcludedVertexes", "" + jvxlData.excludedVertexCount); +if (jvxlData.excludedTriangleCount > 0) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n nExcludedTriangles", "" + jvxlData.excludedTriangleCount); +var n = JU.BSUtil.cardinalityOf(jvxlData.jvxlExcluded[1]); +if (n > 0) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n nInvalidatedVertexes", "" + n); +if (jvxlData.slabInfo != null) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n slabInfo", jvxlData.slabInfo); +if (jvxlData.isJvxlPrecisionColor) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n precisionColor", "true"); +if (jvxlData.colorDensity) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n colorDensity", "true"); +if (!Float.isNaN(jvxlData.pointSize)) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n pointSize", "" + jvxlData.pointSize); + else if (jvxlData.diameter != 0) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n diameter", "" + jvxlData.diameter); +if (!jvxlData.allowVolumeRender) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n allowVolumeRender", "false"); +if (jvxlData.jvxlPlane == null || vertexDataOnly) { +if (jvxlData.fixedLattice != null && !vertexDataOnly) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n fixedLattice", "" + jvxlData.fixedLattice); +if (jvxlData.isContoured) { +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n contoured", "true"); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n colorMapped", "true"); +} else if (jvxlData.isBicolorMap) { +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n bicolorMap", "true"); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n colorNegative", JU.C.getHexCode(jvxlData.minColorIndex)); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n colorPositive", JU.C.getHexCode(jvxlData.maxColorIndex)); +} else if (nColorData > 0) { +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n colorMapped", "true"); +}if (jvxlData.vContours != null && jvxlData.vContours.length > 0) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n nContourData", "" + jvxlData.vContours.length); +} else { +if (jvxlData.mapLattice != null) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n mapLattice", "" + jvxlData.mapLattice); +if (jvxlData.scale3d != 0) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n scale3d", "" + jvxlData.scale3d); +if (nColorData > 0) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n colorMapped", "true"); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n plane", JU.Escape.eP4(jvxlData.jvxlPlane)); +}if (jvxlData.color != null && jvxlData.color.indexOf("null") < 0) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n color", jvxlData.color); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n translucency", "" + jvxlData.translucency); +if (jvxlData.meshColor != null) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n meshColor", jvxlData.meshColor); +if (jvxlData.colorScheme != null) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n colorScheme", jvxlData.colorScheme); +if (jvxlData.rendering != null) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n rendering", jvxlData.rendering); +if (jvxlData.thisSet != null) { +var s = J.jvxl.data.JvxlCoder.subsetString(jvxlData.thisSet); +if (s.startsWith("[")) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n subset", s); + else J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n set", s); +}if (jvxlData.slabValue != -2147483648) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n slabValue", "" + jvxlData.slabValue); +if (jvxlData.isSlabbable) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n slabbable", "true"); +if (jvxlData.nVertexColors > 0) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n nVertexColors", "" + jvxlData.nVertexColors); +var min = (jvxlData.mappedDataMin == 3.4028235E38 ? 0 : jvxlData.mappedDataMin); +var blue = (jvxlData.isColorReversed ? jvxlData.valueMappedToRed : jvxlData.valueMappedToBlue); +var red = (jvxlData.isColorReversed ? jvxlData.valueMappedToBlue : jvxlData.valueMappedToRed); +if (jvxlData.jvxlColorData != null && jvxlData.jvxlColorData.length > 0 && !jvxlData.isBicolorMap) { +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n dataMinimum", "" + min); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n dataMaximum", "" + jvxlData.mappedDataMax); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n valueMappedToRed", "" + red); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n valueMappedToBlue", "" + blue); +}if (jvxlData.isContoured) { +if (jvxlData.contourValues == null || jvxlData.contourColixes == null) { +if (jvxlData.vContours == null) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n nContours", "" + Math.abs(jvxlData.nContours)); +} else { +if (jvxlData.jvxlPlane != null) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n contoured", "true"); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n nContours", "" + jvxlData.contourValues.length); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n contourValues", JU.Escape.eAF(jvxlData.contourValuesUsed == null ? jvxlData.contourValues : jvxlData.contourValuesUsed)); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n contourColors", jvxlData.contourColors); +}if (jvxlData.thisContour > 0) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n thisContour", "" + jvxlData.thisContour); +}if (jvxlData.insideOut) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n insideOut", "true"); +if (jvxlData.vertexDataOnly) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n note", "vertex/face data only"); + else if (jvxlData.isXLowToHigh) J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n note", "progressive JVXL+ -- X values read from low(0) to high(" + (jvxlData.nPointsX - 1) + ")"); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n xyzMin", JU.Escape.eP(jvxlData.boundingBox[0])); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n xyzMax", JU.Escape.eP(jvxlData.boundingBox[1])); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n approximateCompressionRatio", "not calculated"); +J.jvxl.data.JvxlCoder.addAttrib(attribs, "\n jmolVersion", jvxlData.version); +var info = new JU.SB(); +JU.XmlUtil.openTagAttr(info, "jvxlSurfaceInfo", attribs.toArray( new Array(attribs.size()))); +JU.XmlUtil.closeTag(info, "jvxlSurfaceInfo"); +return info.toString(); +}, "J.jvxl.data.JvxlData,~B"); +c$.subsetString = Clazz.defineMethod(c$, "subsetString", +function(bs){ +var n = bs.cardinality(); +if (n > 1) { +var a = "[ "; +for (var ia = bs.nextSetBit(0); ia >= 0; ia = bs.nextSetBit(ia)) a += (++ia) + " "; + +return a + "]"; +}return "" + (bs.nextSetBit(0) + 1); +}, "JU.BS"); +c$.addAttrib = Clazz.defineMethod(c$, "addAttrib", +function(attribs, name, value){ +attribs.addLast( Clazz.newArray(-1, [name, value])); +}, "JU.Lst,~S,~S"); +c$.jvxlEncodeContourData = Clazz.defineMethod(c$, "jvxlEncodeContourData", +function(contours, sb){ +JU.XmlUtil.openTagAttr(sb, "jvxlContourData", Clazz.newArray(-1, ["count", "" + contours.length])); +for (var i = 0; i < contours.length; i++) { +if (contours[i].size() < 6) { +continue; +}var nPolygons = (contours[i].get(0)).intValue(); +var sb1 = new JU.SB(); +sb1.append("\n"); +var bs = contours[i].get(1); +J.jvxl.data.JvxlCoder.jvxlEncodeBitSetBuffer(bs, nPolygons, sb1); +JU.XmlUtil.appendTagObj(sb, "jvxlContour", Clazz.newArray(-1, ["index", "" + i, "value", "" + contours[i].get(2), "color", JU.Escape.escapeColor((contours[i].get(4))[0]), "count", "" + bs.length(), "encoding", "base90iff1", "bsEncoding", "base90+35c", "data", J.jvxl.data.JvxlCoder.jvxlCompressString(contours[i].get(5).toString(), true)]), J.jvxl.data.JvxlCoder.jvxlCompressString(sb1.toString(), true)); +} +JU.XmlUtil.closeTag(sb, "jvxlContourData"); +}, "~A,JU.SB"); +c$.set3dContourVector = Clazz.defineMethod(c$, "set3dContourVector", +function(v, polygonIndexes, vertices){ +if (v.size() < 6) return; +var fData = v.get(5); +var bs = v.get(1); +var pt = 0; +var nBuf = fData.length(); +var type = 0; +var c1 = ' '; +var c2 = ' '; +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { +var vertexIndexes = polygonIndexes[i]; +while (pt < nBuf && !JU.PT.isDigit(c1 = fData.charAt(pt++))) { +} +type = c1.charCodeAt(0) - 48; +while (pt < nBuf && JU.PT.isWhitespace(c1 = fData.charAt(pt++))) { +} +while (pt < nBuf && JU.PT.isWhitespace(c2 = fData.charAt(pt++))) { +} +var f1 = J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter(c1.charCodeAt(0), 35, 90, 0); +var f2 = J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter(c2.charCodeAt(0), 35, 90, 0); +var i1; +var i2; +var i3; +var i4; +if ((type & 1) == 0) { +i1 = vertexIndexes[1]; +i2 = i3 = vertexIndexes[2]; +i4 = vertexIndexes[0]; +} else { +i1 = vertexIndexes[0]; +i2 = vertexIndexes[1]; +if ((type & 2) != 0) { +i3 = i2; +i4 = vertexIndexes[2]; +} else { +i3 = vertexIndexes[2]; +i4 = i1; +}}v.addLast(J.jvxl.data.JvxlCoder.getContourPoint(vertices, i1, i2, f1)); +v.addLast(J.jvxl.data.JvxlCoder.getContourPoint(vertices, i3, i4, f2)); +} +}, "JU.Lst,~A,~A"); +c$.getContourPoint = Clazz.defineMethod(c$, "getContourPoint", +function(vertices, i, j, f){ +var pt = new JU.P3(); +pt.sub2(vertices[j], vertices[i]); +pt.scaleAdd2(f, pt, vertices[i]); +return pt; +}, "~A,~N,~N,~N"); +c$.appendContourTriangleIntersection = Clazz.defineMethod(c$, "appendContourTriangleIntersection", +function(type, f1, f2, fData){ +fData.appendI(type); +fData.appendC(J.jvxl.data.JvxlCoder.jvxlFractionAsCharacter(f1)); +fData.appendC(J.jvxl.data.JvxlCoder.jvxlFractionAsCharacter(f2)); +}, "~N,~N,~N,JU.SB"); +c$.jvxlCreateColorData = Clazz.defineMethod(c$, "jvxlCreateColorData", +function(jvxlData, vertexValues){ +if (vertexValues == null) { +jvxlData.jvxlColorData = ""; +return; +}var writePrecisionColor = jvxlData.isJvxlPrecisionColor; +var doTruncate = jvxlData.isTruncated; +var colorFractionBase = jvxlData.colorFractionBase; +var colorFractionRange = jvxlData.colorFractionRange; +var valueBlue = jvxlData.valueMappedToBlue; +var valueRed = jvxlData.valueMappedToRed; +var vertexCount = (jvxlData.saveVertexCount > 0 ? jvxlData.saveVertexCount : jvxlData.vertexCount); +if (vertexCount > vertexValues.length) System.out.println("JVXLCODER ERROR"); +var isPrecisionColor = jvxlData.isJvxlPrecisionColor; +var min = (isPrecisionColor ? jvxlData.mappedDataMin : jvxlData.valueMappedToRed); +var max = (isPrecisionColor ? jvxlData.mappedDataMax : jvxlData.valueMappedToBlue); +if (vertexValues.length < vertexCount) System.out.println("JVXLCOLOR OHOHO"); +jvxlData.jvxlColorData = J.jvxl.data.JvxlCoder.jvxlEncodeColorData(vertexValues, min, max, colorFractionBase, colorFractionRange, jvxlData.isTruncated, isPrecisionColor); +}, "J.jvxl.data.JvxlData,~A"); +c$.jvxlEncodeColorData = Clazz.defineMethod(c$, "jvxlEncodeColorData", +function(vertexValues, min, max, colorFractionBase, colorFractionRange, doTruncate, isPrecisionColor){ +var list1 = new JU.SB(); +var list2 = new JU.SB(); +for (var i = 0, n = vertexValues.length; i < n; i++) { +var value = vertexValues[i]; +if (Float.isNaN(value)) value = min; +if (doTruncate) value = (value > 0 ? 0.999 : -0.999); +if (isPrecisionColor) J.jvxl.data.JvxlCoder.jvxlAppendCharacter2(value, min, max, colorFractionBase, colorFractionRange, list1, list2); + else list1.appendC(J.jvxl.data.JvxlCoder.jvxlValueAsCharacter(value, min, max, colorFractionBase, colorFractionRange)); +} +return list1.appendSB(list2).appendC('\n').toString(); +}, "~A,~N,~N,~N,~N,~B,~B"); +c$.appendXmlVertexOnlyData = Clazz.defineMethod(c$, "appendXmlVertexOnlyData", +function(sb, jvxlData, meshData, escapeXml){ +var vertexIdNew = Clazz.newIntArray (meshData.vc, 0); +if (J.jvxl.data.JvxlCoder.appendXmlTriangleData(sb, meshData.pis, meshData.pc, meshData.bsSlabDisplay, vertexIdNew, escapeXml)) J.jvxl.data.JvxlCoder.appendXmlVertexData(sb, jvxlData, vertexIdNew, meshData.vs, meshData.vvs, meshData.vc, meshData.polygonColorData, meshData.pc, meshData.bsSlabDisplay, jvxlData.vertexColors, jvxlData.jvxlColorData.length > 0, escapeXml); +}, "JU.SB,J.jvxl.data.JvxlData,J.jvxl.data.MeshData,~B"); +c$.appendXmlTriangleData = Clazz.defineMethod(c$, "appendXmlTriangleData", +function(sb, triangles, nData, bsSlabDisplay, vertexIdNew, escapeXml){ +var list1 = new JU.SB(); +var list2 = new JU.SB(); +var ilast = 1; +var p = 0; +var inew = 0; +var addPlus = false; +var nTri = 0; +var removeSlabbed = (bsSlabDisplay != null); +for (var i = 0; i < nData; ) { +if (triangles[i] == null || (removeSlabbed && !bsSlabDisplay.get(i))) { +i++; +continue; +}var idata = triangles[i][p]; +if (vertexIdNew[idata] > 0) { +idata = vertexIdNew[idata]; +} else { +idata = vertexIdNew[idata] = ++inew; +}var diff = idata - ilast; +ilast = idata; +if (diff == 0) { +list1.appendC('!'); +addPlus = false; +} else if (diff > 32) { +if (addPlus) list1.appendC('+'); +list1.appendI(diff); +addPlus = true; +} else if (diff < -32) { +list1.appendI(diff); +addPlus = true; +} else { +list1.appendC(String.fromCharCode(92 + diff)); +addPlus = false; +}if (++p % 3 == 0) { +list2.appendI(triangles[i][3]); +p = 0; +i++; +nTri++; +}} +if (list1.length() == 0) return true; +JU.XmlUtil.appendTagObj(sb, "jvxlTriangleData", Clazz.newArray(-1, ["count", "" + nTri, "encoding", "jvxltdiff", "data", J.jvxl.data.JvxlCoder.jvxlCompressString(list1.toString(), escapeXml)]), null); +JU.XmlUtil.appendTagObj(sb, "jvxlTriangleEdgeData", Clazz.newArray(-1, ["count", "" + nTri, "encoding", "jvxlsc", "data", J.jvxl.data.JvxlCoder.jvxlCompressString(list2.toString(), escapeXml)]), null); +return true; +}, "JU.SB,~A,~N,JU.BS,~A,~B"); +c$.appendXmlVertexData = Clazz.defineMethod(c$, "appendXmlVertexData", +function(sb, jvxlData, vertexIdNew, vertices, vertexValues, vertexCount, polygonColorData, polygonCount, bsSlabDisplay, vertexColors, addColorData, escapeXml){ +var colorFractionBase = jvxlData.colorFractionBase; +var colorFractionRange = jvxlData.colorFractionRange; +var p; +var min = jvxlData.boundingBox[0]; +var max = jvxlData.boundingBox[1]; +var list1 = new JU.SB(); +var list2 = new JU.SB(); +var vertexIdOld = null; +var removeSlabbed = (bsSlabDisplay != null); +if (polygonCount > 0) { +if (removeSlabbed) polygonCount = bsSlabDisplay.cardinality(); +removeSlabbed = false; +vertexIdOld = Clazz.newIntArray (vertexCount, 0); +for (var i = 0; i < vertexCount; i++) if (vertexIdNew[i] > 0) vertexIdOld[vertexIdNew[i] - 1] = i; + +}var n = 0; +for (var i = 0; i < vertexCount; i++) if (!removeSlabbed || bsSlabDisplay.get(i)) { +n++; +p = vertices[(polygonCount == 0 ? i : vertexIdOld[i])]; +J.jvxl.data.JvxlCoder.jvxlAppendCharacter2(p.x, min.x, max.x, colorFractionBase, colorFractionRange, list1, list2); +J.jvxl.data.JvxlCoder.jvxlAppendCharacter2(p.y, min.y, max.y, colorFractionBase, colorFractionRange, list1, list2); +J.jvxl.data.JvxlCoder.jvxlAppendCharacter2(p.z, min.z, max.z, colorFractionBase, colorFractionRange, list1, list2); +} +list1.appendSB(list2); +JU.XmlUtil.appendTagObj(sb, "jvxlVertexData", Clazz.newArray(-1, ["count", "" + n, "min", JU.Escape.eP(min), "max", JU.Escape.eP(max), "encoding", "base90xyz2", "data", J.jvxl.data.JvxlCoder.jvxlCompressString(list1.toString(), escapeXml)]), null); +if (polygonColorData != null) JU.XmlUtil.appendTagObj(sb, "jvxlPolygonColorData", Clazz.newArray(-1, ["encoding", "jvxlnc", "count", "" + polygonCount]), "\n" + polygonColorData); +if (!addColorData) return; +list1 = new JU.SB(); +list2 = new JU.SB(); +if (vertexColors == null) { +for (var i = 0; i < vertexCount; i++) if (!removeSlabbed || bsSlabDisplay.get(i)) { +var value = vertexValues[polygonCount == 0 ? i : vertexIdOld[i]]; +J.jvxl.data.JvxlCoder.jvxlAppendCharacter2(value, jvxlData.mappedDataMin, jvxlData.mappedDataMax, colorFractionBase, colorFractionRange, list1, list2); +} +} else { +var lastColor = 0; +list1.appendI(n).append(" "); +for (var i = 0; i < vertexCount; i++) if (!removeSlabbed || bsSlabDisplay.get(i)) { +var c = vertexColors[polygonCount == 0 ? i : vertexIdOld[i]]; +if (c == lastColor) c = 0; + else lastColor = c; +list1.appendI(c); +list1.append(" "); +} +}J.jvxl.data.JvxlCoder.appendXmlColorData(sb, list1.appendSB(list2).append("\n").toString(), (vertexColors == null), true, jvxlData.valueMappedToRed, jvxlData.valueMappedToBlue); +}, "JU.SB,J.jvxl.data.JvxlData,~A,~A,~A,~N,~S,~N,JU.BS,~A,~B,~B"); +c$.jvxlFractionAsCharacter = Clazz.defineMethod(c$, "jvxlFractionAsCharacter", +function(fraction){ +return J.jvxl.data.JvxlCoder.jvxlFractionAsCharacterRange(fraction, 35, 90); +}, "~N"); +c$.jvxlFractionAsCharacterRange = Clazz.defineMethod(c$, "jvxlFractionAsCharacterRange", +function(fraction, base, range){ +if (fraction > 0.9999) fraction = 0.9999; + else if (Float.isNaN(fraction)) fraction = 1.0001; +var ich = Clazz.doubleToInt(Math.floor(fraction * range + base)); +if (ich < base) return String.fromCharCode(base); +if (ich == 92) return '!'; +return String.fromCharCode(ich); +}, "~N,~N,~N"); +c$.jvxlAppendCharacter2 = Clazz.defineMethod(c$, "jvxlAppendCharacter2", +function(value, min, max, base, range, list1, list2){ +var fraction = (min == max ? value : (value - min) / (max - min)); +var ch1 = J.jvxl.data.JvxlCoder.jvxlFractionAsCharacterRange(fraction, base, range); +list1.appendC(ch1); +fraction -= J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter(ch1.charCodeAt(0), base, range, 0); +list2.appendC(J.jvxl.data.JvxlCoder.jvxlFractionAsCharacterRange(fraction * range, base, range)); +}, "~N,~N,~N,~N,~N,JU.SB,JU.SB"); +c$.jvxlFractionFromCharacter = Clazz.defineMethod(c$, "jvxlFractionFromCharacter", +function(ich, base, range, fracOffset){ +if (ich == base + range) return NaN; +if (ich < base) ich = 92; +var fraction = (ich - base + fracOffset) / range; +if (fraction < 0) return 0; +if (fraction > 1) return 0.999999; +return fraction; +}, "~N,~N,~N,~N"); +c$.jvxlFractionFromCharacter2 = Clazz.defineMethod(c$, "jvxlFractionFromCharacter2", +function(ich1, ich2, base, range){ +var fraction = J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter(ich1, base, range, 0); +var remains = J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter(ich2, base, range, 0.5); +return fraction + remains / range; +}, "~N,~N,~N,~N"); +c$.jvxlValueAsCharacter = Clazz.defineMethod(c$, "jvxlValueAsCharacter", +function(value, min, max, base, range){ +var fraction = (min == max ? value : (value - min) / (max - min)); +return J.jvxl.data.JvxlCoder.jvxlFractionAsCharacterRange(fraction, base, range); +}, "~N,~N,~N,~N,~N"); +c$.jvxlValueFromCharacter2 = Clazz.defineMethod(c$, "jvxlValueFromCharacter2", +function(ich, ich2, min, max, base, range){ +var fraction = J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter2(ich, ich2, base, range); +return (max == min ? fraction : min + fraction * (max - min)); +}, "~N,~N,~N,~N,~N,~N"); +c$.jvxlEncodeBitSet0 = Clazz.defineMethod(c$, "jvxlEncodeBitSet0", +function(bs, nPoints, sb){ +var dataCount = 0; +var prevCount = -1; +var nPrev = 0; +if (nPoints < 0) nPoints = bs.length(); +var n = 0; +var isset = false; +var lastPoint = nPoints - 1; +for (var i = 0; i < nPoints; ++i) { +if (isset == bs.get(i)) { +dataCount++; +} else { +if (dataCount == prevCount && i != lastPoint) { +nPrev++; +} else { +if (nPrev > 0) { +sb.appendC(' ').appendI(-nPrev); +nPrev = 0; +n++; +}sb.appendC(' ').appendI(dataCount); +n++; +prevCount = dataCount; +}dataCount = 1; +isset = !isset; +}} +sb.appendC(' ').appendI(dataCount).appendC('\n'); +return n; +}, "JU.BS,~N,JU.SB"); +c$.jvxlEncodeBitSet = Clazz.defineMethod(c$, "jvxlEncodeBitSet", +function(bs){ +var sb = new JU.SB(); +J.jvxl.data.JvxlCoder.jvxlEncodeBitSetBuffer(bs, -1, sb); +return sb.toString(); +}, "JU.BS"); +c$.jvxlEncodeBitSetBuffer = Clazz.defineMethod(c$, "jvxlEncodeBitSetBuffer", +function(bs, nPoints, sb){ +var dataCount = 0; +var n = 0; +var isset = false; +if (nPoints < 0) nPoints = bs.length(); +if (nPoints == 0) return 0; +sb.append("-"); +for (var i = 0; i < nPoints; ++i) { +if (isset == bs.get(i)) { +dataCount++; +} else { +J.jvxl.data.JvxlCoder.jvxlAppendEncodedNumber(sb, dataCount, 35, 90); +n++; +dataCount = 1; +isset = !isset; +}} +J.jvxl.data.JvxlCoder.jvxlAppendEncodedNumber(sb, dataCount, 35, 90); +sb.appendC('\n'); +return n; +}, "JU.BS,~N,JU.SB"); +c$.jvxlAppendEncodedNumber = Clazz.defineMethod(c$, "jvxlAppendEncodedNumber", +function(sb, n, base, range){ +var isInRange = (n < range); +if (n == 0) sb.appendC(String.fromCharCode(base)); + else if (!isInRange) sb.appendC(String.fromCharCode(base + range)); +while (n > 0) { +var n1 = Clazz.doubleToInt(n / range); +var x = base + n - n1 * range; +if (x == 92) x = 33; +sb.appendC(String.fromCharCode(x)); +n = n1; +} +if (!isInRange) sb.append(" "); +}, "JU.SB,~N,~N,~N"); +c$.jvxlDecodeBitSetRange = Clazz.defineMethod(c$, "jvxlDecodeBitSetRange", +function(data, base, range){ +var bs = new JU.BS(); +var dataCount = 0; +var ptr = 0; +var isset = false; +var next = Clazz.newIntArray (1, 0); +while ((dataCount = J.jvxl.data.JvxlCoder.jvxlParseEncodedInt(data, base, range, next)) != -2147483648) { +if (isset) bs.setBits(ptr, ptr + dataCount); +ptr += dataCount; +isset = !isset; +} +return bs; +}, "~S,~N,~N"); +c$.jvxlParseEncodedInt = Clazz.defineMethod(c$, "jvxlParseEncodedInt", +function(str, offset, base, next){ +var digitSeen = false; +var value = 0; +var ich = next[0]; +var ichMax = str.length; +if (ich < 0) return -2147483648; +while (ich < ichMax && JU.PT.isWhitespace(str.charAt(ich))) ++ich; + +if (ich >= ichMax) return -2147483648; +var factor = 1; +var isLong = ((str.charAt(ich)).charCodeAt(0) == (offset + base)); +if (isLong) ich++; +while (ich < ichMax && !JU.PT.isWhitespace(str.charAt(ich))) { +var i = (str.charAt(ich)).charCodeAt(0); +if (i < offset) i = 92; +value += (i - offset) * factor; +digitSeen = true; +++ich; +if (!isLong) break; +factor *= base; +} +if (!digitSeen) value = -2147483648; +next[0] = ich; +return value; +}, "~S,~N,~N,~A"); +c$.jvxlDecodeBitSet = Clazz.defineMethod(c$, "jvxlDecodeBitSet", +function(data){ +if (data.startsWith("-")) return J.jvxl.data.JvxlCoder.jvxlDecodeBitSetRange(J.jvxl.data.JvxlCoder.jvxlDecompressString(data.substring(1)), 35, 90); +var bs = new JU.BS(); +var dataCount = 0; +var lastCount = 0; +var nPrev = 0; +var ptr = 0; +var isset = false; +var next = Clazz.newIntArray (1, 0); +while (true) { +dataCount = (nPrev++ < 0 ? dataCount : JU.PT.parseIntNext(data, next)); +if (dataCount == -2147483648) break; +if (dataCount < 0) { +nPrev = dataCount; +dataCount = lastCount; +continue; +}if (isset) bs.setBits(ptr, ptr + dataCount); +ptr += dataCount; +lastCount = dataCount; +isset = !isset; +} +return bs; +}, "~S"); +c$.jvxlCompressString = Clazz.defineMethod(c$, "jvxlCompressString", +function(data, escapeXml){ +if (data.indexOf("~") >= 0) return data; +var dataOut = new JU.SB(); +var chLast = '\u0000'; +var escaped = false; +var lastEscaped = false; +var nLast = 0; +var n = data.length; +for (var i = 0; i <= n; i++) { +var ch = (i == n ? '\0' : data.charAt(i)); +switch ((ch).charCodeAt(0)) { +case 10: +case 13: +continue; +case 38: +case 60: +escaped = escapeXml; +break; +default: +escaped = false; +} +if (ch == chLast) { +++nLast; +ch = '\0'; +} else if (nLast > 0 || lastEscaped) { +if (nLast < 4 && !lastEscaped || chLast == ' ' || chLast == '\t') { +while (--nLast >= 0) dataOut.appendC(chLast); + +} else { +if (lastEscaped) lastEscaped = false; + else dataOut.appendC('~'); +dataOut.appendI(nLast); +dataOut.appendC(' '); +}nLast = 0; +}if (ch != '\0') { +if (escaped) { +lastEscaped = true; +escaped = false; +dataOut.appendC('~'); +chLast = ch; +ch = String.fromCharCode(ch.charCodeAt(0)-1); +} else { +chLast = ch; +}dataOut.appendC(ch); +}} +return dataOut.toString(); +}, "~S,~B"); +c$.jvxlDecompressString = Clazz.defineMethod(c$, "jvxlDecompressString", +function(data){ +if (data.indexOf("~") < 0) return data; +var dataOut = new JU.SB(); +var chLast = '\u0000'; +var next = Clazz.newIntArray (1, 0); +for (var i = 0; i < data.length; i++) { +var ch = data.charAt(i); +if (ch == '~') { +next[0] = ++i; +switch ((ch = data.charAt(i)).charCodeAt(0)) { +case 59: +case 37: +next[0]++; +dataOut.appendC(chLast = (ch = String.fromCharCode(ch.charCodeAt(0)+1))); +case 49: +case 50: +case 51: +case 52: +case 53: +case 54: +case 55: +case 56: +case 57: +var nChar = JU.PT.parseIntNext(data, next); +for (var c = 0; c < nChar; c++) dataOut.appendC(chLast); + +i = next[0]; +continue; +case 126: +--i; +break; +default: +JU.Logger.error("Error uncompressing string " + data.substring(0, i) + "?"); +} +}dataOut.appendC(ch); +chLast = ch; +} +return dataOut.toString(); +}, "~S"); +c$.jvxlCreateHeaderWithoutTitleOrAtoms = Clazz.defineMethod(c$, "jvxlCreateHeaderWithoutTitleOrAtoms", +function(v, bs){ +J.jvxl.data.JvxlCoder.jvxlCreateHeader(v, bs); +}, "J.jvxl.data.VolumeData,JU.SB"); +c$.jvxlCreateHeader = Clazz.defineMethod(c$, "jvxlCreateHeader", +function(v, sb){ +v.setVolumetricXml(); +if (sb.length() == 0) sb.append("Line 1\nLine 2\n"); +}, "J.jvxl.data.VolumeData,JU.SB"); +c$.haveXMLUtil = false; +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/data/JvxlData.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/data/JvxlData.js new file mode 100755 index 000000000000..df2ab2f7e06d --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/data/JvxlData.js @@ -0,0 +1,162 @@ +Clazz.declarePackage("J.jvxl.data"); +Clazz.load(null, "J.jvxl.data.JvxlData", ["JU.SB", "J.jvxl.data.JvxlCoder"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.msg = ""; +this.wasJvxl = false; +this.wasCubic = false; +this.jvxlFileSource = null; +this.jvxlFileTitle = null; +this.jvxlFileMessage = null; +this.jvxlSurfaceData = null; +this.jvxlEdgeData = null; +this.jvxlColorData = null; +this.jvxlVolumeDataXml = null; +this.jvxlExcluded = null; +this.jvxlPlane = null; +this.isJvxlPrecisionColor = false; +this.jvxlDataIsColorMapped = false; +this.jvxlDataIs2dContour = false; +this.jvxlDataIsColorDensity = false; +this.isColorReversed = false; +this.thisSet = null; +this.edgeFractionBase = 35; +this.edgeFractionRange = 90; +this.colorFractionBase = 35; +this.colorFractionRange = 90; +this.isValid = true; +this.insideOut = false; +this.isXLowToHigh = false; +this.isContoured = false; +this.isBicolorMap = false; +this.isTruncated = false; +this.isCutoffAbsolute = false; +this.isModelConnected = false; +this.vertexDataOnly = false; +this.mappedDataMin = 0; +this.mappedDataMax = 0; +this.valueMappedToRed = 0; +this.valueMappedToBlue = 0; +this.cutoff = 0; +this.cutoffRange = null; +this.pointsPerAngstrom = 0; +this.nPointsX = 0; +this.nPointsY = 0; +this.nPointsZ = 0; +this.nBytes = 0; +this.nContours = 0; +this.nEdges = 0; +this.nSurfaceInts = 0; +this.vertexCount = 0; +this.vContours = null; +this.contourColixes = null; +this.contourColors = null; +this.contourValues = null; +this.contourValuesUsed = null; +this.thisContour = -1; +this.scale3d = 0; +this.minColorIndex = -1; +this.maxColorIndex = 0; +this.title = null; +this.version = null; +this.boundingBox = null; +this.excludedTriangleCount = 0; +this.excludedVertexCount = 0; +this.colorDensity = false; +this.pointSize = 0; +this.moleculeXml = null; +this.dataMin = 0; +this.dataMax = 0; +this.saveVertexCount = 0; +this.vertexColorMap = null; +this.nVertexColors = 0; +this.vertexColors = null; +this.color = null; +this.meshColor = null; +this.translucency = 0; +this.colorScheme = null; +this.rendering = null; +this.slabValue = -2147483648; +this.isSlabbable = false; +this.diameter = 0; +this.slabInfo = null; +this.allowVolumeRender = false; +this.voxelVolume = 0; +this.mapLattice = null; +this.fixedLattice = null; +this.baseColor = null; +this.integration = NaN; +this.sbOut = null; +Clazz.instantialize(this, arguments);}, J.jvxl.data, "JvxlData", null); +Clazz.prepareFields (c$, function(){ +this.jvxlExcluded = new Array(4); +}); +Clazz.makeConstructor(c$, +function(){ +}); +Clazz.defineMethod(c$, "clear", +function(){ +this.allowVolumeRender = true; +this.jvxlSurfaceData = ""; +this.jvxlEdgeData = ""; +this.jvxlColorData = ""; +this.jvxlVolumeDataXml = ""; +this.color = null; +this.colorScheme = null; +this.colorDensity = false; +this.pointSize = NaN; +this.contourValues = null; +this.contourValuesUsed = null; +this.contourColixes = null; +this.contourColors = null; +this.integration = NaN; +this.isSlabbable = false; +this.isValid = true; +this.mapLattice = null; +this.meshColor = null; +this.msg = ""; +this.nPointsX = 0; +this.nVertexColors = 0; +this.fixedLattice = null; +this.slabInfo = null; +this.slabValue = -2147483648; +this.thisSet = null; +this.rendering = null; +this.thisContour = -1; +this.translucency = 0; +this.vContours = null; +this.vertexColorMap = null; +this.vertexColors = null; +this.voxelVolume = 0; +}); +Clazz.defineMethod(c$, "setSurfaceInfo", +function(thePlane, mapLattice, nSurfaceInts, surfaceData){ +this.jvxlSurfaceData = surfaceData; +this.jvxlPlane = thePlane; +this.mapLattice = mapLattice; +this.nSurfaceInts = nSurfaceInts; +}, "JU.P4,JU.P3,~N,~S"); +Clazz.defineMethod(c$, "setSurfaceInfoFromBitSet", +function(bs, thePlane){ +this.setSurfaceInfoFromBitSetPts(bs, thePlane, null); +}, "JU.BS,JU.P4"); +Clazz.defineMethod(c$, "setSurfaceInfoFromBitSetPts", +function(bs, thePlane, mapLattice){ +var sb = new JU.SB(); +var nSurfaceInts = (thePlane != null ? 0 : J.jvxl.data.JvxlCoder.jvxlEncodeBitSetBuffer(bs, this.nPointsX * this.nPointsY * this.nPointsZ, sb)); +this.setSurfaceInfo(thePlane, mapLattice, nSurfaceInts, sb.toString()); +}, "JU.BS,JU.P4,JU.P3"); +Clazz.defineMethod(c$, "jvxlUpdateInfo", +function(title, nBytes){ +this.title = title; +this.nBytes = nBytes; +}, "~A,~N"); +c$.updateSurfaceData = Clazz.defineMethod(c$, "updateSurfaceData", +function(edgeData, vertexValues, vertexCount, vertexIncrement, isNaN){ +if (edgeData.length == 0) return ""; +var chars = edgeData.toCharArray(); +for (var i = 0, ipt = 0; i < vertexCount; i += vertexIncrement, ipt++) if (Float.isNaN(vertexValues[i])) chars[ipt] = isNaN; + +return String.copyValueOf(chars); +}, "~S,~A,~N,~N,~S"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/data/MeshData.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/data/MeshData.js new file mode 100755 index 000000000000..9bf984722d96 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/data/MeshData.js @@ -0,0 +1,206 @@ +Clazz.declarePackage("J.jvxl.data"); +Clazz.load(["JU.MeshSurface"], "J.jvxl.data.MeshData", ["java.util.Arrays", "JU.AU", "$.BS", "$.V3", "JU.BSUtil"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.setsSuccessful = false; +this.vertexIncrement = 1; +this.polygonColorData = null; +if (!Clazz.isClassDefined("J.jvxl.data.MeshData.SSet")) { +J.jvxl.data.MeshData.$MeshData$SSet$ (); +} +if (!Clazz.isClassDefined("J.jvxl.data.MeshData.SortSet")) { +J.jvxl.data.MeshData.$MeshData$SortSet$ (); +} +Clazz.instantialize(this, arguments);}, J.jvxl.data, "MeshData", JU.MeshSurface); +Clazz.defineMethod(c$, "addVertexCopy", +function(vertex, value, assocVertex, asCopy){ +if (assocVertex < 0) this.vertexIncrement = -assocVertex; +return this.addVCVal(vertex, value, asCopy); +}, "JU.T3,~N,~N,~B"); +Clazz.defineMethod(c$, "getSurfaceSet", +function(){ +return (this.surfaceSet == null ? this.getSurfaceSetForLevel(0) : this.surfaceSet); +}); +Clazz.defineMethod(c$, "getSurfaceSetForLevel", +function(level){ +if (level == 0) { +this.surfaceSet = new Array(100); +this.nSets = 0; +}this.setsSuccessful = true; +for (var i = 0; i < this.pc; i++) if (this.pis[i] != null) { +if (this.bsSlabDisplay != null && !this.bsSlabDisplay.get(i)) continue; +var p = this.pis[i]; +var pt0 = this.findSet(p[0]); +var pt1 = this.findSet(p[1]); +var pt2 = this.findSet(p[2]); +if (pt0 < 0 && pt1 < 0 && pt2 < 0) { +this.createSet(p[0], p[1], p[2]); +continue; +}if (pt0 == pt1 && pt1 == pt2) continue; +if (pt0 >= 0) { +this.surfaceSet[pt0].set(p[1]); +this.surfaceSet[pt0].set(p[2]); +if (pt1 >= 0 && pt1 != pt0) this.mergeSets(pt0, pt1); +if (pt2 >= 0 && pt2 != pt0 && pt2 != pt1) this.mergeSets(pt0, pt2); +continue; +}if (pt1 >= 0) { +this.surfaceSet[pt1].set(p[0]); +this.surfaceSet[pt1].set(p[2]); +if (pt2 >= 0 && pt2 != pt1) this.mergeSets(pt1, pt2); +continue; +}this.surfaceSet[pt2].set(p[0]); +this.surfaceSet[pt2].set(p[1]); +} +var n = 0; +for (var i = 0; i < this.nSets; i++) if (this.surfaceSet[i] != null) n++; + +var temp = new Array(this.surfaceSet.length); +n = 0; +for (var i = 0; i < this.nSets; i++) if (this.surfaceSet[i] != null) temp[n++] = this.surfaceSet[i]; + +this.nSets = n; +this.surfaceSet = temp; +if (!this.setsSuccessful && level < 2) this.getSurfaceSetForLevel(level + 1); +if (level == 0) { +var sets = new Array(this.nSets); +for (var i = 0; i < this.nSets; i++) sets[i] = Clazz.innerTypeInstance(J.jvxl.data.MeshData.SSet, this, null, this.surfaceSet[i]); + +java.util.Arrays.sort(sets, Clazz.innerTypeInstance(J.jvxl.data.MeshData.SortSet, this, null)); +for (var i = 0; i < this.nSets; i++) this.surfaceSet[i] = sets[i].bs; + +this.setVertexSets(false); +}return this.surfaceSet; +}, "~N"); +Clazz.defineMethod(c$, "setVertexSets", +function(onlyIfNull){ +if (this.surfaceSet == null) return; +var nNull = 0; +for (var i = 0; i < this.nSets; i++) { +if (this.surfaceSet[i] != null && this.surfaceSet[i].nextSetBit(0) < 0) this.surfaceSet[i] = null; +if (this.surfaceSet[i] == null) nNull++; +} +if (nNull > 0) { +var bsNew = new Array(this.nSets - nNull); +for (var i = 0, n = 0; i < this.nSets; i++) if (this.surfaceSet[i] != null) bsNew[n++] = this.surfaceSet[i]; + +this.surfaceSet = bsNew; +this.nSets -= nNull; +} else if (onlyIfNull) { +return; +}this.vertexSets = Clazz.newIntArray (this.vc, 0); +for (var i = 0; i < this.nSets; i++) for (var j = this.surfaceSet[i].nextSetBit(0); j >= 0; j = this.surfaceSet[i].nextSetBit(j + 1)) this.vertexSets[j] = i; + + +}, "~B"); +Clazz.defineMethod(c$, "findSet", +function(vertex){ +for (var i = 0; i < this.nSets; i++) if (this.surfaceSet[i] != null && this.surfaceSet[i].get(vertex)) return i; + +return -1; +}, "~N"); +Clazz.defineMethod(c$, "createSet", +function(v1, v2, v3){ +var i; +for (i = 0; i < this.nSets; i++) if (this.surfaceSet[i] == null) break; + +if (i == this.surfaceSet.length) this.surfaceSet = JU.AU.ensureLength(this.surfaceSet, this.surfaceSet.length + 100); +this.surfaceSet[i] = new JU.BS(); +this.surfaceSet[i].set(v1); +this.surfaceSet[i].set(v2); +this.surfaceSet[i].set(v3); +if (i == this.nSets) this.nSets++; +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "mergeSets", +function(a, b){ +this.surfaceSet[a].or(this.surfaceSet[b]); +this.surfaceSet[b] = null; +}, "~N,~N"); +Clazz.defineMethod(c$, "invalidateSurfaceSet", +function(i){ +for (var j = this.surfaceSet[i].nextSetBit(0); j >= 0; j = this.surfaceSet[i].nextSetBit(j + 1)) this.vvs[j] = NaN; + +this.surfaceSet[i] = null; +}, "~N"); +c$.checkCutoff = Clazz.defineMethod(c$, "checkCutoff", +function(iA, iB, iC, vertexValues){ +if (iA < 0 || iB < 0 || iC < 0) return false; +var val1 = vertexValues[iA]; +var val2 = vertexValues[iB]; +var val3 = vertexValues[iC]; +return (val1 >= 0 && val2 >= 0 && val3 >= 0 || val1 <= 0 && val2 <= 0 && val3 <= 0); +}, "~N,~N,~N,~A"); +c$.calculateVolumeOrArea = Clazz.defineMethod(c$, "calculateVolumeOrArea", +function(m, thisSet, isArea, getSets){ +if (getSets || m.nSets <= 0) m.getSurfaceSet(); +var justOne = (thisSet != null && thisSet.cardinality() == 1); +var n = (justOne || m.nSets <= 0 ? 1 : m.nSets); +var v = Clazz.newDoubleArray (n, 0); +var vAB = new JU.V3(); +var vAC = new JU.V3(); +var vTemp = new JU.V3(); +for (var i = m.pc; --i >= 0; ) { +if (m.setABC(i) == null) continue; +var iSet = (m.nSets <= 0 ? 0 : m.vertexSets[m.iA]); +if (thisSet != null && !thisSet.get(iSet)) continue; +if (isArea) { +vAB.sub2(m.vs[m.iB], m.vs[m.iA]); +vAC.sub2(m.vs[m.iC], m.vs[m.iA]); +vTemp.cross(vAB, vAC); +v[justOne ? 0 : iSet] += vTemp.length(); +} else { +vAB.setT(m.vs[m.iB]); +vAC.setT(m.vs[m.iC]); +vTemp.cross(vAB, vAC); +vAC.setT(m.vs[m.iA]); +v[justOne ? 0 : iSet] += vAC.dot(vTemp); +}} +var factor = (isArea ? 2 : 6); +for (var i = 0; i < n; i++) v[i] /= factor; + +if (justOne) return Float.$valueOf(v[0]); +if (thisSet != null) { +thisSet.and(JU.BSUtil.newBitSet2(0, v.length)); +var v1 = Clazz.newDoubleArray (thisSet.cardinality(), 0); +for (var pt = 0, i = thisSet.nextSetBit(0); i >= 0; i = thisSet.nextSetBit(i + 1)) { +v1[pt++] = v[i]; +} +v = v1; +}return v; +}, "J.jvxl.data.MeshData,JU.BS,~B,~B"); +Clazz.defineMethod(c$, "updateInvalidatedVertices", +function(bs){ +bs.clearAll(); +for (var i = 0; i < this.vc; i += this.vertexIncrement) if (Float.isNaN(this.vvs[i])) bs.set(i); + +}, "JU.BS"); +Clazz.defineMethod(c$, "invalidateVertices", +function(bsInvalid){ +for (var i = bsInvalid.nextSetBit(0); i >= 0; i = bsInvalid.nextSetBit(i + 1)) this.vvs[i] = NaN; + +}, "JU.BS"); +c$.$MeshData$SSet$ = function(){ +/*if4*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +Clazz.prepareCallback(this, arguments); +this.bs = null; +this.n = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.data.MeshData, "SSet", null); +Clazz.makeConstructor(c$, +function(bs){ +this.bs = bs; +this.n = bs.cardinality(); +}, "JU.BS"); +/*eoif4*/})(); +}; +c$.$MeshData$SortSet$ = function(){ +/*if4*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +Clazz.prepareCallback(this, arguments); +Clazz.instantialize(this, arguments);}, J.jvxl.data.MeshData, "SortSet", null, java.util.Comparator); +Clazz.overrideMethod(c$, "compare", +function(o1, o2){ +return (o1.n > o2.n ? -1 : o1.n < o2.n ? 1 : 0); +}, "J.jvxl.data.MeshData.SSet,J.jvxl.data.MeshData.SSet"); +/*eoif4*/})(); +}; +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/data/VolumeData.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/data/VolumeData.js new file mode 100755 index 000000000000..d2e049ddd658 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/data/VolumeData.js @@ -0,0 +1,384 @@ +Clazz.declarePackage("J.jvxl.data"); +Clazz.load(["JU.M3", "$.P3", "$.V3"], "J.jvxl.data.VolumeData", ["java.util.Hashtable", "JU.SB", "JU.Escape", "$.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.sr = null; +this.doIterate = true; +this.volumetricOrigin = null; +this.origin = null; +this.volumetricVectors = null; +this.voxelCounts = null; +this.nPoints = 0; +this.voxelData = null; +this.voxelMap = null; +this.volumetricVectorLengths = null; +this.maxVectorLength = 0; +this.minToPlaneDistance = 0; +this.yzCount = 0; +this.unitVolumetricVectors = null; +this.volumetricMatrix = null; +this.inverseMatrix = null; +this.thePlane = null; +this.thePlaneNormalMag = 0; +this.ptXyzTemp = null; +this.xmlData = null; +this.mappingPlane = null; +this.mappingPlaneNormalMag = 0; +this.minGrid = 0; +this.maxGrid = 0; +this.voxelVolume = 0; +this.oabc = null; +this.isPeriodic = false; +this.isSquared = false; +this.edgeVector = null; +this.ptTemp = null; +Clazz.instantialize(this, arguments);}, J.jvxl.data, "VolumeData", null); +Clazz.prepareFields (c$, function(){ +this.volumetricOrigin = new JU.P3(); +this.origin = Clazz.newFloatArray (3, 0); +this.volumetricVectors = new Array(3); +this.voxelCounts = Clazz.newIntArray (3, 0); +this.volumetricVectorLengths = Clazz.newFloatArray (3, 0); +this.unitVolumetricVectors = new Array(3); +this.volumetricMatrix = new JU.M3(); +this.inverseMatrix = new JU.M3(); +this.ptXyzTemp = new JU.P3(); +this.edgeVector = new JU.V3(); +this.ptTemp = new JU.P3(); +}); +Clazz.makeConstructor(c$, +function(){ +this.volumetricVectors[0] = new JU.V3(); +this.volumetricVectors[1] = new JU.V3(); +this.volumetricVectors[2] = new JU.V3(); +this.unitVolumetricVectors[0] = new JU.V3(); +this.unitVolumetricVectors[1] = new JU.V3(); +this.unitVolumetricVectors[2] = new JU.V3(); +}); +Clazz.defineMethod(c$, "getVoxelData", +function(){ +return this.voxelData; +}); +Clazz.defineMethod(c$, "setVoxelDataAsArray", +function(voxelData){ +this.voxelData = voxelData; +if (voxelData != null) this.sr = null; +}, "~A"); +Clazz.defineMethod(c$, "hasPlane", +function(){ +return (this.thePlane != null); +}); +Clazz.defineMethod(c$, "setMappingPlane", +function(plane){ +this.mappingPlane = plane; +if (plane == null) return; +this.mappingPlaneNormalMag = Math.sqrt(plane.x * plane.x + plane.y * plane.y + plane.z * plane.z); +}, "JU.P4"); +Clazz.defineMethod(c$, "distanceToMappingPlane", +function(pt){ +return (this.mappingPlane.x * pt.x + this.mappingPlane.y * pt.y + this.mappingPlane.z * pt.z + this.mappingPlane.w) / this.mappingPlaneNormalMag; +}, "JU.T3"); +Clazz.defineMethod(c$, "setVolumetricOrigin", +function(x, y, z){ +this.volumetricOrigin.set(x, y, z); +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "getOriginFloat", +function(){ +return this.origin; +}); +Clazz.defineMethod(c$, "getYzCount", +function(){ +this.minGrid = this.volumetricVectors[0].length(); +this.minGrid = Math.min(this.minGrid, this.volumetricVectors[1].length()); +this.minGrid = Math.min(this.minGrid, this.volumetricVectors[2].length()); +this.maxGrid = this.volumetricVectors[0].length(); +this.maxGrid = Math.max(this.maxGrid, this.volumetricVectors[1].length()); +this.maxGrid = Math.max(this.maxGrid, this.volumetricVectors[2].length()); +this.nPoints = this.voxelCounts[0] * this.voxelCounts[1] * this.voxelCounts[2]; +return this.yzCount = this.voxelCounts[1] * this.voxelCounts[2]; +}); +Clazz.defineMethod(c$, "getVolumetricVectorLengths", +function(){ +return this.volumetricVectorLengths; +}); +Clazz.defineMethod(c$, "setVolumetricVector", +function(i, x, y, z){ +this.volumetricVectors[i].x = x; +this.volumetricVectors[i].y = y; +this.volumetricVectors[i].z = z; +this.setUnitVectors(); +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "getVoxelCounts", +function(){ +return this.voxelCounts; +}); +Clazz.defineMethod(c$, "setVoxelCounts", +function(nPointsX, nPointsY, nPointsZ){ +this.voxelCounts[0] = nPointsX; +this.voxelCounts[1] = nPointsY; +this.voxelCounts[2] = nPointsZ; +return nPointsX * nPointsY * nPointsZ; +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "getVoxelDataAt", +function(pt){ +var ix = Clazz.doubleToInt(pt / this.yzCount); +pt -= ix * this.yzCount; +var iy = Clazz.doubleToInt(pt / this.voxelCounts[2]); +var iz = pt - iy * this.voxelCounts[2]; +return this.voxelData[ix][iy][iz]; +}, "~N"); +Clazz.defineMethod(c$, "getPointIndex", +function(x, y, z){ +return x * this.yzCount + y * this.voxelCounts[2] + z; +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "getPoint", +function(ipt, pt){ +var ix = Clazz.doubleToInt(ipt / this.yzCount); +ipt -= ix * this.yzCount; +var iy = Clazz.doubleToInt(ipt / this.voxelCounts[2]); +var iz = ipt - iy * this.voxelCounts[2]; +this.voxelPtToXYZ(ix, iy, iz, pt); +}, "~N,JU.P3"); +Clazz.defineMethod(c$, "setVoxelData", +function(pt, value){ +var ix = Clazz.doubleToInt(pt / this.yzCount); +pt -= ix * this.yzCount; +var iy = Clazz.doubleToInt(pt / this.voxelCounts[2]); +var iz = pt - iy * this.voxelCounts[2]; +this.voxelData[ix][iy][iz] = value; +}, "~N,~N"); +Clazz.defineMethod(c$, "setVoxelMap", +function(){ +this.voxelMap = new java.util.Hashtable(); +this.getYzCount(); +}); +Clazz.defineMethod(c$, "setMatrix", +function(){ +for (var i = 0; i < 3; i++) this.volumetricMatrix.setColumnV(i, this.volumetricVectors[i]); + +try { +this.inverseMatrix.invertM(this.volumetricMatrix); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.error("VolumeData error setting matrix -- bad unit vectors? "); +return false; +} else { +throw e; +} +} +return true; +}); +Clazz.defineMethod(c$, "transform", +function(v1, v2){ +this.volumetricMatrix.rotate2(v1, v2); +}, "JU.V3,JU.V3"); +Clazz.defineMethod(c$, "setPlaneParameters", +function(plane){ +this.thePlane = plane; +this.thePlaneNormalMag = Math.sqrt(plane.x * plane.x + plane.y * plane.y + plane.z * plane.z); +}, "JU.P4"); +Clazz.defineMethod(c$, "calcVoxelPlaneDistance", +function(x, y, z){ +this.voxelPtToXYZ(x, y, z, this.ptXyzTemp); +return this.distancePointToPlane(this.ptXyzTemp); +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "getToPlaneParameter", +function(){ +return (Math.sqrt(this.thePlane.x * this.thePlane.x + this.thePlane.y * this.thePlane.y + this.thePlane.z * this.thePlane.z) * this.minToPlaneDistance); +}); +Clazz.defineMethod(c$, "isNearPlane", +function(x, y, z, toPlaneParameter){ +this.voxelPtToXYZ(x, y, z, this.ptXyzTemp); +return ((this.thePlane.x * this.ptXyzTemp.x + this.thePlane.y * this.ptXyzTemp.y + this.thePlane.z * this.ptXyzTemp.z + this.thePlane.w) < toPlaneParameter); +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "distancePointToPlane", +function(pt){ +return (this.thePlane.x * pt.x + this.thePlane.y * pt.y + this.thePlane.z * pt.z + this.thePlane.w) / this.thePlaneNormalMag; +}, "JU.T3"); +Clazz.defineMethod(c$, "voxelPtToXYZ", +function(x, y, z, pt){ +pt.scaleAdd2(x, this.volumetricVectors[0], this.volumetricOrigin); +pt.scaleAdd2(y, this.volumetricVectors[1], pt); +pt.scaleAdd2(z, this.volumetricVectors[2], pt); +}, "~N,~N,~N,JU.T3"); +Clazz.defineMethod(c$, "setUnitVectors", +function(){ +this.maxVectorLength = 0; +this.voxelVolume = 1; +for (var i = 0; i < 3; i++) { +var d = this.volumetricVectorLengths[i] = this.volumetricVectors[i].length(); +if (d == 0) return false; +if (d > this.maxVectorLength) this.maxVectorLength = d; +this.voxelVolume *= d; +this.unitVolumetricVectors[i].setT(this.volumetricVectors[i]); +this.unitVolumetricVectors[i].normalize(); +} +this.minToPlaneDistance = this.maxVectorLength * 2; +this.origin[0] = this.volumetricOrigin.x; +this.origin[1] = this.volumetricOrigin.y; +this.origin[2] = this.volumetricOrigin.z; +this.oabc = new Array(4); +this.oabc[0] = JU.V3.newV(this.volumetricOrigin); +for (var i = 0; i < 3; i++) { +var v = this.oabc[i + 1] = new JU.V3(); +v.scaleAdd2(this.voxelCounts[i] - 1, this.volumetricVectors[i], v); +} +return this.setMatrix(); +}); +Clazz.defineMethod(c$, "xyzToVoxelPt", +function(x, y, z, pt3i){ +this.ptXyzTemp.set(x, y, z); +this.ptXyzTemp.sub(this.volumetricOrigin); +this.inverseMatrix.rotate(this.ptXyzTemp); +pt3i.set(Math.round(this.ptXyzTemp.x), Math.round(this.ptXyzTemp.y), Math.round(this.ptXyzTemp.z)); +}, "~N,~N,~N,JU.T3i"); +Clazz.defineMethod(c$, "lookupInterpolatedVoxelValue", +function(point, getSource){ +if (this.mappingPlane != null) return this.distanceToMappingPlane(point); +if (this.sr != null) { +var v = this.sr.getValueAtPoint(point, getSource); +return (this.isSquared ? v * v : v); +}this.ptXyzTemp.sub2(point, this.volumetricOrigin); +this.inverseMatrix.rotate(this.ptXyzTemp); +var iMax; +var xLower = this.indexLower(this.ptXyzTemp.x, iMax = this.voxelCounts[0] - 1); +var xUpper = this.indexUpper(this.ptXyzTemp.x, xLower, iMax); +var yLower = this.indexLower(this.ptXyzTemp.y, iMax = this.voxelCounts[1] - 1); +var yUpper = this.indexUpper(this.ptXyzTemp.y, yLower, iMax); +var zLower = this.indexLower(this.ptXyzTemp.z, iMax = this.voxelCounts[2] - 1); +var zUpper = this.indexUpper(this.ptXyzTemp.z, zLower, iMax); +var v1 = J.jvxl.data.VolumeData.getFractional2DValue(this.mantissa(this.ptXyzTemp.x - xLower), this.mantissa(this.ptXyzTemp.y - yLower), this.getVoxelValue(xLower, yLower, zLower), this.getVoxelValue(xUpper, yLower, zLower), this.getVoxelValue(xLower, yUpper, zLower), this.getVoxelValue(xUpper, yUpper, zLower)); +var v2 = J.jvxl.data.VolumeData.getFractional2DValue(this.mantissa(this.ptXyzTemp.x - xLower), this.mantissa(this.ptXyzTemp.y - yLower), this.getVoxelValue(xLower, yLower, zUpper), this.getVoxelValue(xUpper, yLower, zUpper), this.getVoxelValue(xLower, yUpper, zUpper), this.getVoxelValue(xUpper, yUpper, zUpper)); +return v1 + this.mantissa(this.ptXyzTemp.z - zLower) * (v2 - v1); +}, "JU.T3,~B"); +Clazz.defineMethod(c$, "mantissa", +function(f){ +return (this.isPeriodic ? f - Math.floor(f) : f); +}, "~N"); +Clazz.defineMethod(c$, "getVoxelValue", +function(x, y, z){ +if (this.voxelMap == null) return this.voxelData[x][y][z]; +var f = this.voxelMap.get(Integer.$valueOf(this.getPointIndex(x, y, z))); +return (f == null ? NaN : f.floatValue()); +}, "~N,~N,~N"); +c$.getFractional2DValue = Clazz.defineMethod(c$, "getFractional2DValue", +function(fx, fy, x11, x12, x21, x22){ +var v1 = x11 + fx * (x12 - x11); +var v2 = x21 + fx * (x22 - x21); +return v1 + fy * (v2 - v1); +}, "~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "indexLower", +function(x, xMax){ +if (this.isPeriodic && xMax > 0) { +while (x < 0) x += xMax; + +while (x >= xMax) x -= xMax; + +return Clazz.doubleToInt(Math.floor(x)); +}if (x < 0) return 0; +var floor = Clazz.doubleToInt(Math.floor(x)); +return (floor > xMax ? xMax : floor); +}, "~N,~N"); +Clazz.defineMethod(c$, "indexUpper", +function(x, xLower, xMax){ +return (!this.isPeriodic && x < 0 || xLower == xMax ? xLower : xLower + 1); +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "offsetCenter", +function(center){ +var pt = new JU.P3(); +pt.scaleAdd2((this.voxelCounts[0] - 1) / 2, this.volumetricVectors[0], pt); +pt.scaleAdd2((this.voxelCounts[1] - 1) / 2, this.volumetricVectors[1], pt); +pt.scaleAdd2((this.voxelCounts[2] - 1) / 2, this.volumetricVectors[2], pt); +this.volumetricOrigin.sub2(center, pt); +}, "JU.P3"); +Clazz.defineMethod(c$, "setDataDistanceToPlane", +function(plane){ +this.setPlaneParameters(plane); +var nx = this.voxelCounts[0]; +var ny = this.voxelCounts[1]; +var nz = this.voxelCounts[2]; +this.voxelData = Clazz.newFloatArray (nx, ny, nz, 0); +for (var x = 0; x < nx; x++) for (var y = 0; y < ny; y++) for (var z = 0; z < nz; z++) this.voxelData[x][y][z] = this.calcVoxelPlaneDistance(x, y, z); + + + +}, "JU.P4"); +Clazz.defineMethod(c$, "filterData", +function(isSquared, invertCutoff){ +var doInvert = (!Float.isNaN(invertCutoff)); +if (this.sr != null) { +this.isSquared = isSquared; +return; +}var nx = this.voxelCounts[0]; +var ny = this.voxelCounts[1]; +var nz = this.voxelCounts[2]; +if (isSquared) for (var x = 0; x < nx; x++) for (var y = 0; y < ny; y++) for (var z = 0; z < nz; z++) this.voxelData[x][y][z] *= this.voxelData[x][y][z]; + + + +if (doInvert) for (var x = 0; x < nx; x++) for (var y = 0; y < ny; y++) for (var z = 0; z < nz; z++) this.voxelData[x][y][z] = invertCutoff - this.voxelData[x][y][z]; + + + +}, "~B,~N"); +Clazz.defineMethod(c$, "capData", +function(plane, cutoff){ +if (this.voxelData == null) return; +var nx = this.voxelCounts[0]; +var ny = this.voxelCounts[1]; +var nz = this.voxelCounts[2]; +var normal = JU.V3.new3(plane.x, plane.y, plane.z); +normal.normalize(); +var f = 1; +for (var x = 0; x < nx; x++) for (var y = 0; y < ny; y++) for (var z = 0; z < nz; z++) { +var value = this.voxelData[x][y][z] - cutoff; +this.voxelPtToXYZ(x, y, z, this.ptXyzTemp); +var d = (this.ptXyzTemp.x * normal.x + this.ptXyzTemp.y * normal.y + this.ptXyzTemp.z * normal.z + plane.w - cutoff) / f; +if (d >= 0 || d > value) this.voxelData[x][y][z] = d; +} + + +}, "JU.P4,~N"); +Clazz.defineMethod(c$, "setVolumetricXml", +function(){ +var sb = new JU.SB(); +if (this.voxelCounts[0] == 0) { +sb.append("= 0; j = bs.nextSetBit(j + 1)) s += "," + (j + offset); + +var na = bs.cardinality(); +nH += na; +info = JU.PT.rep(info, "%ATOMS%", s.substring(1)); +info = JU.PT.rep(info, "%S%", (na == 1 ? "" : "s")); +info = JU.PT.rep(info, "%NATOMS%", "" + na); +}JU.Logger.info("adding PeakData " + info); +this.loader.addPeakData(info); +} +this.loader.setSpectrumPeaks(nH, this.piUnitsX, this.piUnitsY); +return n; +}, "JU.Lst,~N"); +Clazz.defineMethod(c$, "getStringInfo", +function(file, title, mytype, model, atoms, htSets, key, list, more){ +if ("HNMR".equals(mytype)) mytype = "1HNMR"; + else if ("CNMR".equals(mytype)) mytype = "13CNMR"; +var type = (mytype == null ? "" : " type=" + JU.PT.esc(mytype)); +if (title == null) title = ("1HNMR".equals(mytype) ? "atom%S%: %ATOMS%; integration: %NATOMS%" : ""); +title = " title=" + JU.PT.esc(title); +var stringInfo = " = 0) { +this.line = this.loader.discardLinesUntilContains(" \n"); +} else { +sb.append(" \n"); +for (var i = 0; i < 3; i++) sb.append(" \n"); +return this.xmlData = sb.toString(); +}); +Clazz.defineMethod(c$, "setVoxelMapValue", +function(x, y, z, v){ +if (this.voxelMap == null) return; +this.voxelMap.put(Integer.$valueOf(this.getPointIndex(x, y, z)), Float.$valueOf(v)); +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "calculateFractionalPoint", +function(cutoff, pointA, pointB, valueA, valueB, pt){ +var d = (valueB - valueA); +var fraction = (cutoff - valueA) / d; +this.edgeVector.sub2(pointB, pointA); +pt.scaleAdd2(fraction, this.edgeVector, pointA); +if (this.sr == null || !this.doIterate || valueB == valueA || fraction < 0.01 || fraction > 0.99 || (this.edgeVector.length()) < 0.01) return cutoff; +var n = 0; +this.ptTemp.setT(pt); +var v = this.lookupInterpolatedVoxelValue(this.ptTemp, false); +var v0 = NaN; +while (++n < 10) { +var fnew = (v - valueA) / d; +if (fnew < 0 || fnew > 1) break; +var diff = (cutoff - v) / d / 2; +fraction += diff; +if (fraction < 0 || fraction > 1) break; +pt.setT(this.ptTemp); +v0 = v; +if (Math.abs(diff) < 0.005) break; +this.ptTemp.scaleAdd2(diff, this.edgeVector, pt); +v = this.lookupInterpolatedVoxelValue(this.ptTemp, false); +} +return v0; +}, "~N,JU.P3,JU.P3,~N,~N,JU.P3"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/ApbsReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/ApbsReader.js new file mode 100755 index 000000000000..1cab0763172b --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/ApbsReader.js @@ -0,0 +1,37 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.VolumeFileReader"], "J.jvxl.readers.ApbsReader", ["JU.PT", "$.SB"], function(){ +var c$ = Clazz.declareType(J.jvxl.readers, "ApbsReader", J.jvxl.readers.VolumeFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.ApbsReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2VFR(sg, br); +if (this.params.thePlane == null) this.params.insideOut = !this.params.insideOut; +this.isAngstroms = true; +this.nSurfaces = 1; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +this.jvxlFileHeaderBuffer = JU.SB.newS(this.skipComments(false)); +while (this.line != null && this.line.length == 0) this.rd(); + +this.jvxlFileHeaderBuffer.append("APBS OpenDx DATA ").append(this.line).append("\n"); +this.jvxlFileHeaderBuffer.append("see http://apbs.sourceforge.net\n"); +var atomLine = this.rd(); +var tokens = JU.PT.getTokens(atomLine); +if (tokens.length >= 4) { +this.volumetricOrigin.set(this.parseFloatStr(tokens[1]), this.parseFloatStr(tokens[2]), this.parseFloatStr(tokens[3])); +}J.jvxl.readers.VolumeFileReader.checkAtomLine(this.isXLowToHigh, this.isAngstroms, tokens[0], atomLine, this.jvxlFileHeaderBuffer); +this.readVoxelVector(0); +this.readVoxelVector(1); +this.readVoxelVector(2); +this.rd(); +tokens = this.getTokens(); +for (var i = 0; i < 3; i++) this.voxelCounts[i] = this.parseIntStr(tokens[i + 5]); + +this.rd(); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/AtomDataReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/AtomDataReader.js new file mode 100755 index 000000000000..3190055ceae3 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/AtomDataReader.js @@ -0,0 +1,378 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.VolumeDataReader", "JU.BS", "$.P3", "$.P3i", "J.atomdata.AtomData"], "J.jvxl.readers.AtomDataReader", ["java.util.Date", "JU.AU", "$.SB", "$.V3", "J.atomdata.RadiusData", "J.c.VDW", "J.jvxl.data.JvxlCoder", "JU.BSUtil", "$.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.maxDistance = 0; +this.contactPair = null; +this.fileName = null; +this.fileDotModel = null; +this.modelIndex = 0; +this.atomData = null; +this.atomXyzTruncated = null; +this.atomRadius = null; +this.atomProp = null; +this.atomNo = null; +this.atomIndex = null; +this.myIndex = null; +this.ac = 0; +this.myAtomCount = 0; +this.nearbyAtomCount = 0; +this.firstNearbyAtom = 0; +this.bsMySelected = null; +this.bsMyIgnored = null; +this.bsNearby = null; +this.doAddHydrogens = false; +this.havePlane = false; +this.doUseIterator = false; +this.theProperty = 0; +this.haveOneProperty = false; +this.minPtsPerAng = 0; +this.sr = 0; +this.rs = null; +this.rs2 = null; +this.maxRS = 0; +this.thisPlane = null; +this.thisAtomSet = null; +this.thisX = 0; +this.margin = 0; +this.vl0 = 0; +this.vl1 = 0; +this.vl2 = 0; +this.bsSurfaceVoxels = null; +this.validSpheres = null; +this.noFaceSpheres = null; +this.voxelSource = null; +this.ptY0 = null; +this.ptZ0 = null; +this.pt0 = null; +this.pt1 = null; +this.ptV = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "AtomDataReader", J.jvxl.readers.VolumeDataReader); +Clazz.prepareFields (c$, function(){ +this.atomData = new J.atomdata.AtomData(); +this.bsMySelected = new JU.BS(); +this.bsMyIgnored = new JU.BS(); +this.ptY0 = new JU.P3(); +this.ptZ0 = new JU.P3(); +this.pt0 = new JU.P3i(); +this.pt1 = new JU.P3i(); +this.ptV = new JU.P3(); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.AtomDataReader, []); +}); +Clazz.defineMethod(c$, "initADR", +function(sg){ +this.initVDR(sg); +this.precalculateVoxelData = true; +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.overrideMethod(c$, "setup", +function(isMapData){ +this.setup2(); +}, "~B"); +Clazz.defineMethod(c$, "setup2", +function(){ +this.contactPair = this.params.contactPair; +this.doAddHydrogens = (this.sg.atomDataServer != null && this.params.addHydrogens); +this.modelIndex = this.params.modelIndex; +if (this.params.bsIgnore != null) this.bsMyIgnored = this.params.bsIgnore; +if (this.params.volumeData != null) { +this.setVolumeDataV(this.params.volumeData); +this.setBBox(this.volumeData.volumetricOrigin, 0); +this.ptV.setT(this.volumeData.volumetricOrigin); +for (var i = 0; i < 3; i++) this.ptV.scaleAdd2(this.volumeData.voxelCounts[i] - 1, this.volumeData.volumetricVectors[i], this.ptV); + +this.setBBox(this.ptV, 0); +}this.havePlane = (this.params.thePlane != null); +if (this.havePlane) this.volumeData.setPlaneParameters(this.params.thePlane); +}); +Clazz.defineMethod(c$, "markPlaneVoxels", +function(p, r){ +for (var i = 0, pt = this.thisX * this.yzCount, pt1 = pt + this.yzCount; pt < pt1; pt++, i++) { +this.volumeData.getPoint(pt, this.ptV); +this.thisPlane[i] = this.ptV.distance(p) - r; +} +}, "JU.P3,~N"); +Clazz.defineMethod(c$, "setVolumeForPlane", +function(){ +if (this.useOriginStepsPoints) { +this.xyzMin = JU.P3.newP(this.params.origin); +this.xyzMax = JU.P3.newP(this.params.origin); +this.xyzMax.add3((this.params.points.x - 1) * this.params.steps.x, (this.params.points.y - 1) * this.params.steps.y, (this.params.points.z - 1) * this.params.steps.z); +} else if (this.params.boundingBox == null) { +this.getAtoms(this.params.bsSelected, false, true, false, false, false, false, this.params.mep_marginAngstroms, this.params.modelInvRotation); +if (this.xyzMin == null) { +this.xyzMin = JU.P3.new3(-10, -10, -10); +this.xyzMax = JU.P3.new3(10, 10, 10); +}} else { +this.xyzMin = JU.P3.newP(this.params.boundingBox[0]); +this.xyzMax = JU.P3.newP(this.params.boundingBox[1]); +}this.setRanges(this.params.plane_ptsPerAngstrom, this.params.plane_gridMax, 0); +}); +Clazz.defineMethod(c$, "getAtoms", +function(bsSelected, doAddHydrogens, getRadii, getMolecules, getAllModels, addNearbyAtoms, getAtomMinMax, marginAtoms, modelInvRotation){ +if (addNearbyAtoms) getRadii = true; +if (getRadii) { +if (this.params.atomRadiusData == null) this.params.atomRadiusData = new J.atomdata.RadiusData(null, 1, J.atomdata.RadiusData.EnumType.FACTOR, J.c.VDW.AUTO); +this.atomData.radiusData = this.params.atomRadiusData; +this.atomData.radiusData.valueExtended = this.params.solventExtendedAtomRadius; +if (doAddHydrogens) this.atomData.radiusData.vdwType = J.c.VDW.NOJMOL; +}this.atomData.modelIndex = this.modelIndex; +this.atomData.bsSelected = bsSelected; +this.atomData.bsIgnored = this.bsMyIgnored; +this.sg.fillAtomData(this.atomData, 1 | (getAllModels ? 16 : 0) | (getMolecules ? 4 : 0) | (getRadii ? 2 : 0)); +if (this.doUseIterator) this.atomData.bsSelected = null; +this.ac = this.atomData.ac; +this.modelIndex = this.atomData.firstModelIndex; +if (modelInvRotation != null) this.atomData.transformXYZ(modelInvRotation, bsSelected); +var needRadius = false; +for (var i = 0; i < this.ac; i++) { +if ((bsSelected == null || bsSelected.get(i)) && (!this.bsMyIgnored.get(i))) { +if (this.havePlane && Math.abs(this.volumeData.distancePointToPlane(this.atomData.xyz[i])) > 2 * (this.atomData.atomRadius[i] = this.getWorkingRadius(i, marginAtoms))) continue; +this.bsMySelected.set(i); +needRadius = !this.havePlane; +}if (getRadii && (addNearbyAtoms || needRadius)) this.atomData.atomRadius[i] = this.getWorkingRadius(i, marginAtoms); +} +var rH = (getRadii && doAddHydrogens ? this.getWorkingRadius(-1, marginAtoms) : 0); +this.myAtomCount = JU.BSUtil.cardinalityOf(this.bsMySelected); +var atomSet = JU.BSUtil.copy(this.bsMySelected); +var nH = 0; +this.atomProp = null; +this.theProperty = 3.4028235E38; +this.haveOneProperty = false; +var props = this.params.theProperty; +if (this.myAtomCount > 0) { +var hAtoms = null; +if (doAddHydrogens) { +this.atomData.bsSelected = atomSet; +this.sg.atomDataServer.fillAtomData(this.atomData, 8); +hAtoms = new Array(nH = this.atomData.hydrogenAtomCount); +for (var i = 0; i < this.atomData.hAtoms.length; i++) if (this.atomData.hAtoms[i] != null) for (var j = this.atomData.hAtoms[i].length; --j >= 0; ) hAtoms[--nH] = this.atomData.hAtoms[i][j]; + + +nH = hAtoms.length; +JU.Logger.info(nH + " attached hydrogens added"); +}var n = nH + this.myAtomCount; +if (getRadii) this.atomRadius = Clazz.newFloatArray (n, 0); +this.atomXyzTruncated = new Array(n); +if (this.params.theProperty != null) this.atomProp = Clazz.newFloatArray (n, 0); +this.atomNo = Clazz.newIntArray (n, 0); +this.atomIndex = Clazz.newIntArray (n, 0); +this.myIndex = Clazz.newIntArray (this.ac, 0); +for (var i = 0; i < nH; i++) { +if (getRadii) this.atomRadius[i] = rH; +this.atomXyzTruncated[i] = hAtoms[i]; +this.atomNo[i] = -1; +if (this.atomProp != null) this.addAtomProp(i, NaN); +} +this.myAtomCount = nH; +for (var i = atomSet.nextSetBit(0); i >= 0; i = atomSet.nextSetBit(i + 1)) { +if (this.atomProp != null) this.addAtomProp(this.myAtomCount, (props != null && i < props.length ? props[i] : NaN)); +this.atomXyzTruncated[this.myAtomCount] = this.atomData.xyz[i]; +this.atomNo[this.myAtomCount] = this.atomData.atomicNumber[i]; +this.atomIndex[this.myAtomCount] = i; +this.myIndex[i] = this.myAtomCount; +if (getRadii) this.atomRadius[this.myAtomCount] = this.atomData.atomRadius[i]; +this.myAtomCount++; +} +}this.firstNearbyAtom = this.myAtomCount; +if (!this.isQuiet) JU.Logger.info(this.myAtomCount + " atoms will be used in the surface calculation"); +if (this.myAtomCount == 0) { +this.setBBox(JU.P3.new3(10, 10, 10), 0); +this.setBBox(JU.P3.new3(-10, -10, -10), 0); +}for (var i = 0; i < this.myAtomCount; i++) this.setBBox(this.atomXyzTruncated[i], getRadii ? this.atomRadius[i] + 0.5 : 0); + +if (!Float.isNaN(this.params.scale)) { +var v = JU.V3.newVsub(this.xyzMax, this.xyzMin); +v.scale(0.5); +this.xyzMin.add(v); +v.scale(this.params.scale); +this.xyzMax.add2(this.xyzMin, v); +this.xyzMin.sub(v); +}if (!addNearbyAtoms || this.myAtomCount == 0) return; +var pt = new JU.P3(); +this.bsNearby = new JU.BS(); +for (var i = 0; i < this.ac; i++) { +if (atomSet.get(i) || this.bsMyIgnored.get(i)) continue; +var rA = this.atomData.atomRadius[i]; +if (this.params.thePlane != null && Math.abs(this.volumeData.distancePointToPlane(this.atomData.xyz[i])) > 2 * rA) continue; +if (this.params.theProperty != null) rA += this.maxDistance; +pt = this.atomData.xyz[i]; +if (pt.x + rA > this.xyzMin.x && pt.x - rA < this.xyzMax.x && pt.y + rA > this.xyzMin.y && pt.y - rA < this.xyzMax.y && pt.z + rA > this.xyzMin.z && pt.z - rA < this.xyzMax.z) { +this.bsNearby.set(i); +this.nearbyAtomCount++; +}} +var nAtoms = this.myAtomCount; +if (this.nearbyAtomCount != 0) { +nAtoms += this.nearbyAtomCount; +this.atomRadius = JU.AU.arrayCopyF(this.atomRadius, nAtoms); +this.atomXyzTruncated = JU.AU.arrayCopyObject(this.atomXyzTruncated, nAtoms); +if (this.atomIndex != null) this.atomIndex = JU.AU.arrayCopyI(this.atomIndex, nAtoms); +if (props != null) this.atomProp = JU.AU.arrayCopyF(this.atomProp, nAtoms); +for (var i = this.bsNearby.nextSetBit(0); i >= 0; i = this.bsNearby.nextSetBit(i + 1)) { +if (props != null) this.addAtomProp(this.myAtomCount, props[i]); +this.myIndex[i] = this.myAtomCount; +this.atomIndex[this.myAtomCount] = i; +this.atomXyzTruncated[this.myAtomCount] = this.atomData.xyz[i]; +this.atomRadius[this.myAtomCount++] = this.atomData.atomRadius[i]; +} +}if (getRadii) this.setRadii(); +this.haveOneProperty = (!Float.isNaN(this.theProperty)); +}, "JU.BS,~B,~B,~B,~B,~B,~B,~N,JU.M4"); +Clazz.defineMethod(c$, "setRadii", +function(){ +if (this.rs != null) return; +this.maxRS = 0; +this.rs = Clazz.newFloatArray (this.myAtomCount, 0); +this.rs2 = Clazz.newFloatArray (this.myAtomCount, 0); +for (var i = 0; i < this.myAtomCount; i++) { +var r = this.rs[i] = this.atomRadius[i] + this.sr; +if (r > this.maxRS) this.maxRS = r; +this.rs2[i] = this.rs[i] * this.rs[i]; +} +}); +Clazz.defineMethod(c$, "addAtomProp", +function(i, f){ +this.atomProp[i] = f; +if (!Float.isNaN(this.theProperty)) if (f != this.theProperty) this.theProperty = (this.theProperty == 3.4028235E38 ? f : NaN); +}, "~N,~N"); +Clazz.defineMethod(c$, "getWorkingRadius", +function(i, marginAtoms){ +var r = (i < 0 ? this.atomData.hAtomRadius : this.atomData.atomRadius[i]); +return (Float.isNaN(marginAtoms) ? Math.max(r, 0.1) : r + marginAtoms); +}, "~N,~N"); +Clazz.defineMethod(c$, "setHeader", +function(calcType, line2){ +this.jvxlFileHeaderBuffer = new JU.SB(); +if (this.atomData.programInfo != null) this.jvxlFileHeaderBuffer.append("#created by ").append(this.atomData.programInfo).append(" on ").append("" + new java.util.Date()).append("\n"); +this.jvxlFileHeaderBuffer.append(calcType).append("\n").append(line2).append("\n"); +}, "~S,~S"); +Clazz.defineMethod(c$, "setRanges", +function(ptsPerAngstrom, maxGrid, minPtsPerAng){ +if (this.xyzMin == null) return; +this.ptsPerAngstrom = ptsPerAngstrom; +this.maxGrid = maxGrid; +this.minPtsPerAng = minPtsPerAng; +this.setVolumeData(); +J.jvxl.data.JvxlCoder.jvxlCreateHeader(this.volumeData, this.jvxlFileHeaderBuffer); +}, "~N,~N,~N"); +Clazz.overrideMethod(c$, "setVolumeData", +function(){ +this.setVolumeDataADR(); +}); +Clazz.defineMethod(c$, "setVolumeDataADR", +function(){ +if (!this.setVolumeDataParams()) { +this.setVoxelRange(0, this.xyzMin.x, this.xyzMax.x, this.ptsPerAngstrom, this.maxGrid, this.minPtsPerAng); +this.setVoxelRange(1, this.xyzMin.y, this.xyzMax.y, this.ptsPerAngstrom, this.maxGrid, this.minPtsPerAng); +this.setVoxelRange(2, this.xyzMin.z, this.xyzMax.z, this.ptsPerAngstrom, this.maxGrid, this.minPtsPerAng); +}}); +Clazz.defineMethod(c$, "setVertexSource", +function(){ +if (this.meshDataServer != null) this.meshDataServer.fillMeshData(this.meshData, 1, null); +if (this.params.vertexSource != null) { +this.params.vertexSource = JU.AU.arrayCopyI(this.params.vertexSource, this.meshData.vc); +for (var i = 0; i < this.meshData.vc; i++) this.params.vertexSource[i] = Math.abs(this.params.vertexSource[i]) - 1; + +}}); +Clazz.defineMethod(c$, "resetPlane", +function(value){ +for (var i = 0; i < this.yzCount; i++) this.thisPlane[i] = value; + +}, "~N"); +Clazz.defineMethod(c$, "resetVoxelData", +function(value){ +for (var x = 0; x < this.nPointsX; ++x) for (var y = 0; y < this.nPointsY; ++y) for (var z = 0; z < this.nPointsZ; ++z) this.voxelData[x][y][z] = value; + + + +}, "~N"); +Clazz.defineMethod(c$, "getVoxel", +function(i, j, k, ipt){ +return (this.isProgressive ? this.thisPlane[ipt % this.yzCount] : this.voxelData[i][j][k]); +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "unsetVoxelData", +function(){ +this.unsetVoxelData2(); +}); +Clazz.defineMethod(c$, "unsetVoxelData2", +function(){ +if (this.isProgressive) for (var i = 0; i < this.yzCount; i++) { +if (this.thisPlane[i] == 3.4028235E38) this.thisPlane[i] = NaN; +} + else for (var x = 0; x < this.nPointsX; ++x) for (var y = 0; y < this.nPointsY; ++y) for (var z = 0; z < this.nPointsZ; ++z) if (this.voxelData[x][y][z] == 3.4028235E38) this.voxelData[x][y][z] = NaN; + + + +}); +Clazz.defineMethod(c$, "setGridLimitsForAtom", +function(ptA, rA, pt0, pt1){ +rA += this.margin; +this.volumeData.xyzToVoxelPt(ptA.x, ptA.y, ptA.z, pt0); +var x = Clazz.doubleToInt(Math.floor(rA / this.volumeData.volumetricVectorLengths[0])); +var y = Clazz.doubleToInt(Math.floor(rA / this.volumeData.volumetricVectorLengths[1])); +var z = Clazz.doubleToInt(Math.floor(rA / this.volumeData.volumetricVectorLengths[2])); +pt1.set(pt0.x + x, pt0.y + y, pt0.z + z); +pt0.set(pt0.x - x, pt0.y - y, pt0.z - z); +pt0.x = Math.max(pt0.x - 1, 0); +pt0.y = Math.max(pt0.y - 1, 0); +pt0.z = Math.max(pt0.z - 1, 0); +pt1.x = Math.min(pt1.x + 1, this.nPointsX); +pt1.y = Math.min(pt1.y + 1, this.nPointsY); +pt1.z = Math.min(pt1.z + 1, this.nPointsZ); +}, "JU.P3,~N,JU.P3i,JU.P3i"); +Clazz.defineMethod(c$, "getAtomMinMax", +function(bs, bsAtomMinMax){ +for (var i = 0; i < this.nPointsX; i++) bsAtomMinMax[i] = new JU.BS(); + +for (var iAtom = this.myAtomCount; --iAtom >= 0; ) { +if (bs != null && !bs.get(iAtom)) continue; +this.setGridLimitsForAtom(this.atomXyzTruncated[iAtom], this.atomRadius[iAtom], this.pt0, this.pt1); +for (var i = this.pt0.x; i < this.pt1.x; i++) bsAtomMinMax[i].set(iAtom); + +} +}, "JU.BS,~A"); +Clazz.defineMethod(c$, "markSphereVoxels", +function(r0, distance){ +var isWithin = (distance != 3.4028235E38 && this.point != null); +var v0 = this.volumetricVectors[0]; +var v1 = this.volumetricVectors[1]; +var v2 = this.volumetricVectors[2]; +for (var iAtom = this.thisAtomSet.nextSetBit(0); iAtom >= 0; iAtom = this.thisAtomSet.nextSetBit(iAtom + 1)) { +if (!this.havePlane && this.validSpheres != null && !this.validSpheres.get(iAtom)) continue; +var isSurface = (this.noFaceSpheres != null && this.noFaceSpheres.get(iAtom)); +var isNearby = (iAtom >= this.firstNearbyAtom); +var ptA = this.atomXyzTruncated[iAtom]; +var rA = this.atomRadius[iAtom]; +if (isWithin && ptA.distance(this.point) > distance + rA + 0.5) continue; +var rA0 = rA + r0; +this.setGridLimitsForAtom(ptA, rA0, this.pt0, this.pt1); +if (this.isProgressive) { +this.pt0.x = this.thisX; +this.pt1.x = this.thisX + 1; +}this.volumeData.voxelPtToXYZ(this.pt0.x, this.pt0.y, this.pt0.z, this.ptV); +for (var i = this.pt0.x; i < this.pt1.x; i++, this.ptV.add2(v0, this.ptY0)) { +this.ptY0.setT(this.ptV); +for (var j = this.pt0.y; j < this.pt1.y; j++, this.ptV.add2(v1, this.ptZ0)) { +this.ptZ0.setT(this.ptV); +for (var k = this.pt0.z; k < this.pt1.z; k++, this.ptV.add(v2)) { +var value = this.ptV.distance(ptA) - rA; +var ipt = this.volumeData.getPointIndex(i, j, k); +if ((r0 == 0 || value <= rA0) && value < this.getVoxel(i, j, k, ipt)) { +if (isNearby || isWithin && this.ptV.distance(this.point) > distance) value = NaN; +this.setVoxel(i, j, k, ipt, value); +if (!Float.isNaN(value)) { +if (this.voxelSource != null) this.voxelSource[ipt] = iAtom + 1; +if (value < 0 && isSurface) this.bsSurfaceVoxels.set(ipt); +}}} +} +} +} +}, "~N,~N"); +Clazz.defineMethod(c$, "setVoxel", +function(i, j, k, ipt, value){ +if (this.isProgressive) this.thisPlane[ipt % this.yzCount] = value; + else this.voxelData[i][j][k] = value; +}, "~N,~N,~N,~N,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/AtomPropertyMapper.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/AtomPropertyMapper.js new file mode 100755 index 000000000000..63a709f5f439 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/AtomPropertyMapper.js @@ -0,0 +1,118 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.AtomDataReader"], "J.jvxl.readers.AtomPropertyMapper", ["J.api.Interface", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.mepCalc = null; +this.mepType = null; +this.calcType = 0; +this.doSmoothProperty = false; +this.iter = null; +this.smoothingPower = 0; +this.iAtomSurface = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "AtomPropertyMapper", J.jvxl.readers.AtomDataReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.AtomPropertyMapper, []); +}); +Clazz.overrideMethod(c$, "init", +function(sg){ +this.initADR(sg); +this.mepType = sg.getReaderData(); +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.overrideMethod(c$, "setup", +function(isMapData){ +this.setup2(); +this.haveSurfaceAtoms = true; +this.volumeData.sr = this; +this.volumeData.doIterate = false; +this.point = this.params.point; +this.doSmoothProperty = this.params.propertySmoothing; +this.doUseIterator = true; +if (this.doSmoothProperty) { +this.smoothingPower = this.params.propertySmoothingPower; +if (this.smoothingPower < 0) this.smoothingPower = 0; + else if (this.smoothingPower > 10) this.smoothingPower = 10; +if (this.smoothingPower == 0) this.doSmoothProperty = false; +this.smoothingPower = (this.smoothingPower - 11) / 2; +}this.maxDistance = this.params.propertyDistanceMax; +if (this.mepType != null) { +this.doSmoothProperty = true; +if (this.params.mep_calcType >= 0) this.calcType = this.params.mep_calcType; +this.mepCalc = J.api.Interface.getOption("quantum." + this.mepType + "Calculation", this.sg.atomDataServer, "file"); +}if (!this.doSmoothProperty && this.maxDistance == 2147483647) this.maxDistance = 5; +this.getAtoms(this.params.bsSelected, this.doAddHydrogens, true, false, false, true, false, NaN, null); +if (this.meshDataServer != null) this.meshDataServer.fillMeshData(this.meshData, 1, null); +if (!this.doSmoothProperty && this.meshData.vertexSource != null) { +this.hasColorData = true; +for (var i = this.meshData.vc; --i >= 0; ) { +var iAtom = this.meshData.vertexSource[i]; +if (iAtom >= 0) { +this.meshData.vvs[i] = this.params.theProperty[iAtom]; +} else { +this.hasColorData = false; +break; +}} +}this.setHeader("property", this.params.calculationType); +this.setRanges(this.params.solvent_ptsPerAngstrom, this.params.solvent_gridMax, 0); +this.params.cutoff = 0; +}, "~B"); +Clazz.overrideMethod(c$, "setVolumeData", +function(){ +if (this.params.thePlane != null) this.setVolumeDataADR(); +}); +Clazz.overrideMethod(c$, "initializeMapping", +function(){ +if (this.params.showTiming) JU.Logger.startTimer("property mapping"); +if (this.bsNearby != null) this.bsMySelected.or(this.bsNearby); +this.iter = this.sg.atomDataServer.getSelectedAtomIterator(this.bsMySelected, false, false, false); +}); +Clazz.overrideMethod(c$, "finalizeMapping", +function(){ +this.iter.release(); +this.iter = null; +if (this.params.showTiming) JU.Logger.checkTimer("property mapping", false); +}); +Clazz.overrideMethod(c$, "generateCube", +function(){ +}); +Clazz.overrideMethod(c$, "getSurfaceAtomIndex", +function(){ +return this.iAtomSurface; +}); +Clazz.overrideMethod(c$, "getValueAtPoint", +function(pt, getSource){ +if (this.haveOneProperty && !getSource) return this.theProperty; +var dmin = 3.4028235E38; +var dminNearby = 3.4028235E38; +var value = (this.doSmoothProperty ? 0 : NaN); +var vdiv = 0; +this.sg.atomDataServer.setIteratorForPoint(this.iter, this.modelIndex, pt, this.maxDistance); +this.iAtomSurface = -1; +while (this.iter.hasNext()) { +var ia = this.iter.next(); +var myAtom = this.myIndex[ia]; +var isNearby = (myAtom >= this.firstNearbyAtom); +var ptA = this.atomXyzTruncated[myAtom]; +var p = this.atomProp[myAtom]; +if (Float.isNaN(p)) continue; +var d2 = pt.distanceSquared(ptA); +if (isNearby) { +if (d2 < dminNearby) { +dminNearby = d2; +if (!this.doSmoothProperty && dminNearby < dmin) { +dmin = d2; +value = NaN; +}}} else if (d2 < dmin) { +dmin = d2; +this.iAtomSurface = ia; +if (!this.doSmoothProperty) value = p; +}if (this.mepCalc != null) { +value += this.mepCalc.valueFor(p, d2, this.calcType); +} else if (this.doSmoothProperty) { +d2 = Math.pow(d2, this.smoothingPower); +vdiv += d2; +value += d2 * p; +}} +return (this.mepCalc != null ? value : this.doSmoothProperty ? (vdiv == 0 || dminNearby < dmin ? NaN : value / vdiv) : value); +}, "JU.T3,~B"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/BCifDensityReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/BCifDensityReader.js new file mode 100755 index 000000000000..0977489e3a9e --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/BCifDensityReader.js @@ -0,0 +1,201 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.MapFileReader"], "J.jvxl.readers.BCifDensityReader", ["java.io.BufferedInputStream", "$.ByteArrayInputStream", "JU.AU", "$.BC", "$.MessagePackReader", "$.P3", "$.SB", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.header = null; +this.pt = 0; +this.checkSum = 0; +this.values = null; +this.cifData = null; +this.thisData = null; +this.isDiff = false; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "BCifDensityReader", J.jvxl.readers.MapFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.BCifDensityReader, []); +}); +Clazz.defineMethod(c$, "getCifData", +function(fileName, data){ +this.binarydoc = this.newBinaryDocument(); +if (JU.AU.isAB(data)) this.binarydoc.setStream( new java.io.BufferedInputStream( new java.io.ByteArrayInputStream(data)), true); + else this.setStream(fileName, true); +this.nSurfaces = 1; +}, "~S,~O"); +Clazz.defineMethod(c$, "readCifP3", +function(key, p3){ +if (p3 == null) p3 = new JU.P3(); +var x = this.getCifFloat(key + "[0]"); +if (Float.isNaN(x)) { +p3.x = NaN; +} else { +p3.x = x; +p3.y = this.getCifFloat(key + "[1]"); +p3.z = this.getCifFloat(key + "[2]"); +}return p3; +}, "~S,JU.P3"); +Clazz.defineMethod(c$, "getCifMap", +function(type){ +if (this.cifData == null) try { +this.cifData = ( new JU.MessagePackReader(this.binarydoc, true)).readMap(); +System.out.println("BCifDensityReader BCIF encoder " + this.cifData.get("encoder") + " BCIF version " + this.cifData.get("version")); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +System.out.println("BCifDensityReader error " + e); +} else { +throw e; +} +} +var dataBlocks = this.cifData.get("dataBlocks"); +for (var i = dataBlocks.length; --i >= 0; ) { +var map = dataBlocks[i]; +this.header = map.get("header").toString(); +if ("EM".equals(this.header) || type.equalsIgnoreCase(this.header)) { +var categories = map.get("categories"); +for (var j = categories.length; --j >= 0; ) { +var cat = categories[j]; +var catName = cat.get("name"); +var columns = cat.get("columns"); +for (var k = columns.length; --k >= 0; ) { +var col = columns[k]; +map.put(catName + "_" + col.get("name"), col.get("data")); +} +} +map.remove("categories"); +return this.thisData = map; +}} +return null; +}, "~S"); +Clazz.defineMethod(c$, "getCifFloat", +function(key){ +var map = this.thisData.get(key); +var data = map.get("data"); +var encoding = (((map.get("encoding"))[0]).get("type")).intValue(); +var f = NaN; +try { +switch (encoding) { +case 3: +f = JU.BC.bytesToInt(data, 0, false); +break; +case 33: +f = JU.BC.bytesToDoubleToFloat(data, 0, false); +break; +default: +System.out.println("BCifDensityReader: Number encoding not recognized: " + encoding); +break; +} +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +e.printStackTrace(); +} else { +throw e; +} +} +return f; +}, "~S"); +Clazz.defineMethod(c$, "readCifFloats", +function(key, values){ +var map = this.thisData.get(key); +var data = map.get("data"); +var encoding = (map.get("encoding"))[0]; +var min = (encoding.get("min")).floatValue(); +var max = (encoding.get("max")).floatValue(); +var numSteps = (encoding.get("numSteps")).intValue(); +var kind = encoding.get("kind"); +if ("IntervalQuantization".equals(kind)) { +var delta = (max - min) / (numSteps - 1); +for (var i = data.length; --i >= 0; ) { +values[i] = min + delta * ((data[i] + 256) % 256); +} +} else { +System.out.println("BCifDensityReader: value encoding type? " + kind); +}return values; +}, "~S,~A"); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.allowSigma = true; +this.init2MFR(sg, br); +var o2 = sg.getReaderData(); +var fileName = o2[0]; +var data = o2[1]; +this.isDiff = (fileName != null && fileName.indexOf("&diff=1") >= 0 || (typeof(data)=='string') && (data).indexOf("#diff=1") >= 0); +this.getCifData(fileName, data); +this.nSurfaces = 1; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +this.getCifMap(this.isDiff ? "FO-FC" : "2FO-FC"); +this.readCifP3("_volume_data_3d_info_axis_order", this.p3); +var axis_order = this.readCifP3("_volume_data_3d_info_axis_order", null); +var fracOrigin = this.readCifP3("_volume_data_3d_info_origin", null); +var fracDimensions = this.readCifP3("_volume_data_3d_info_dimensions", null); +var sampleCounts = this.readCifP3("_volume_data_3d_info_sample_count", this.p3); +this.mapc = Clazz.floatToInt(axis_order.x) + 1; +this.mapr = Clazz.floatToInt(axis_order.y) + 1; +this.maps = Clazz.floatToInt(axis_order.z) + 1; +var crs2abc = Clazz.newIntArray (3, 0); +crs2abc[this.mapc - 1] = 0; +crs2abc[this.mapr - 1] = 1; +crs2abc[this.maps - 1] = 2; +this.n0 = Clazz.floatToInt(sampleCounts.x); +this.n1 = Clazz.floatToInt(sampleCounts.y); +this.n2 = Clazz.floatToInt(sampleCounts.z); +this.na = Clazz.floatToInt(this.getXYZ(sampleCounts, crs2abc[0])); +this.nb = Clazz.floatToInt(this.getXYZ(sampleCounts, crs2abc[1])); +this.nc = Clazz.floatToInt(this.getXYZ(sampleCounts, crs2abc[2])); +this.readCifP3("_volume_data_3d_info_spacegroup_cell_size", this.p3); +this.a = this.p3.x; +this.b = this.p3.y; +this.c = this.p3.z; +var fa = this.getXYZ(fracDimensions, crs2abc[0]); +var fb = this.getXYZ(fracDimensions, crs2abc[1]); +var fc = this.getXYZ(fracDimensions, crs2abc[2]); +this.xyzStart[this.xIndex = 0] = this.getXYZ(fracOrigin, crs2abc[0]) * this.na / fa; +this.xyzStart[this.yIndex = 1] = this.getXYZ(fracOrigin, crs2abc[1]) * this.nb / fb; +this.xyzStart[this.zIndex = 2] = this.getXYZ(fracOrigin, crs2abc[2]) * this.nc / fc; +this.a *= fa; +this.b *= fb; +this.c *= fc; +this.readCifP3("_volume_data_3d_info_spacegroup_cell_angles", this.p3); +this.alpha = this.p3.x; +this.beta = this.p3.y; +this.gamma = this.p3.z; +this.values = this.readCifFloats("_volume_data_3d_values", Clazz.newFloatArray (this.na * this.nb * this.nc, 0)); +this.getVectorsAndOrigin(); +if (this.params.thePlane == null && (this.params.cutoffAutomatic || !Float.isNaN(this.params.sigma))) { +var sigma = (this.params.sigma < 0 || Float.isNaN(this.params.sigma) ? 1 : this.params.sigma); +this.dmean = this.getCifFloat("_volume_data_3d_info_mean_sampled"); +var rmsDeviation = this.getCifFloat("_volume_data_3d_info_sigma_sampled"); +this.params.cutoff = rmsDeviation * sigma + this.dmean; +JU.Logger.info("Cutoff set to (mean + rmsDeviation*" + sigma + " = " + this.params.cutoff + ")\n"); +}this.jvxlFileHeaderBuffer = new JU.SB(); +this.jvxlFileHeaderBuffer.append("BCifDensity reader type=" + this.header + "\n"); +}); +Clazz.defineMethod(c$, "getXYZ", +function(a, x){ +switch (Clazz.floatToInt(x)) { +case 0: +return a.x; +case 1: +return a.y; +case 2: +default: +return a.z; +} +}, "JU.P3,~N"); +Clazz.overrideMethod(c$, "nextVoxel", +function(){ +var v = this.values[this.pt++]; +this.checkSum += v; +return v; +}); +Clazz.overrideMethod(c$, "skipData", +function(nPoints){ +this.pt += nPoints; +}, "~N"); +Clazz.defineMethod(c$, "closeReader", +function(){ +if (this.readerClosed) return; +System.out.println("CifDensityReader checkSum=" + this.checkSum); +Clazz.superCall(this, J.jvxl.readers.BCifDensityReader, "closeReader", []); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/CastepDensityReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/CastepDensityReader.js new file mode 100755 index 000000000000..3c59a6d2374d --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/CastepDensityReader.js @@ -0,0 +1,87 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.PeriodicVolumeFileReader"], "J.jvxl.readers.CastepDensityReader", ["JU.PT", "$.SB"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.nFilePoints = 0; +this.nSkip = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "CastepDensityReader", J.jvxl.readers.PeriodicVolumeFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.CastepDensityReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2VFR(sg, br); +this.isProgressive = false; +this.isAngstroms = true; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "gotoData", +function(n, nPoints){ +this.nSkip = n; +}, "~N,~N"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +this.jvxlFileHeaderBuffer = new JU.SB(); +while (this.rd() != null && this.line.indexOf(".") < 0) { +} +for (var i = 0; i < 3; ++i) { +var voxelVector = this.volumetricVectors[i]; +voxelVector.set(this.parseFloatStr(this.line), this.parseFloat(), this.parseFloat()); +this.rd(); +} +this.nSurfaces = this.parseIntStr(this.rd()); +this.rd(); +this.voxelCounts[0] = (this.nPointsX = this.parseIntStr(this.line)) + 1; +this.voxelCounts[1] = (this.nPointsY = this.parseInt()) + 1; +this.voxelCounts[2] = (this.nPointsZ = this.parseInt()) + 1; +this.nFilePoints = (this.nPointsX++) * (this.nPointsY++) * (this.nPointsZ++); +this.volumetricOrigin.set(0, 0, 0); +for (var i = 0; i < 3; i++) { +this.volumetricVectors[i].scale(1 / (this.voxelCounts[i] - 1)); +if (this.isAnisotropic) this.setVectorAnisotropy(this.volumetricVectors[i]); +} +while (this.rd().trim().length > 0) { +} +}); +Clazz.overrideMethod(c$, "getPeriodicVoxels", +function(){ +this.rd(); +var tokens = this.getTokens(); +if (this.nSkip > 0 && tokens.length < 3 + this.nSurfaces) { +for (var j = 0; j < this.nSkip; j++) for (var i = 0; i < this.nFilePoints; i++) this.rd(); + + +this.nSkip = 0; +}var dsf = this.downsampleFactor; +if (dsf > 1) { +for (var i = 0; i < this.nFilePoints; i++) { +var x = this.parseIntStr(this.line) - 1; +var y = this.parseInt() - 1; +var z = this.parseInt() - 1; +if (x % dsf == 0 && y % dsf == 0 && z % dsf == 0) { +if (this.nSkip > 0) this.skipPoints(this.nSkip); +this.voxelData[Clazz.doubleToInt(x / dsf)][Clazz.doubleToInt(y / dsf)][Clazz.doubleToInt(z / dsf)] = this.recordData(this.parseFloat()); +}this.rd(); +} +} else { +for (var i = 0; i < this.nFilePoints; i++) { +var x = this.parseIntStr(this.line) - 1; +var y = this.parseInt() - 1; +var z = this.parseInt() - 1; +if (this.nSkip > 0) this.skipPoints(this.nSkip); +this.voxelData[x][y][z] = this.recordData(this.parseFloat()); +this.rd(); +} +}}); +Clazz.defineMethod(c$, "skipPoints", +function(n){ +var pt = this.next[0]; +for (var i = 0; i < n; i++) { +while (pt < this.line.length && JU.PT.isWhitespace(this.line.charAt(pt++))) { +} +while (pt < this.line.length && !JU.PT.isWhitespace(this.line.charAt(pt++))) { +} +} +this.next[0] = pt; +}, "~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/CifDensityReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/CifDensityReader.js new file mode 100755 index 000000000000..8d98c7691e58 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/CifDensityReader.js @@ -0,0 +1,53 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.BCifDensityReader"], "J.jvxl.readers.CifDensityReader", ["JU.P3", "$.PT"], function(){ +var c$ = Clazz.declareType(J.jvxl.readers, "CifDensityReader", J.jvxl.readers.BCifDensityReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.CifDensityReader, []); +}); +Clazz.overrideMethod(c$, "getCifData", +function(fileName, data){ +this.cifData = this.sg.atomDataServer.readCifData(fileName, data, "CIF"); +}, "~S,~O"); +Clazz.overrideMethod(c$, "readCifP3", +function(key, p3){ +if (p3 == null) p3 = new JU.P3(); +var x = this.getCifFloat(key + "[0]"); +if (Float.isNaN(x)) { +p3.x = NaN; +} else { +p3.x = x; +p3.y = this.getCifFloat(key + "[1]"); +p3.z = this.getCifFloat(key + "[2]"); +}return p3; +}, "~S,JU.P3"); +Clazz.overrideMethod(c$, "getCifMap", +function(type){ +type = "data_" + type; +var list = this.cifData.get("models"); +for (var i = 0; i < list.size(); i++) { +var map = list.get(i); +if (type.equalsIgnoreCase(map.get("name").toString())) return this.thisData = map; +} +return null; +}, "~S"); +Clazz.overrideMethod(c$, "getCifFloat", +function(key){ +var o = this.thisData.get(key); +var x = NaN; +if (o != null) { +if ((typeof(o)=='string')) { +x = JU.PT.parseFloat(o); +} else if (Clazz.instanceOf(o, Number)) { +x = (o).floatValue(); +}}return x; +}, "~S"); +Clazz.overrideMethod(c$, "readCifFloats", +function(key, values){ +var list = this.thisData.get(key); +for (var i = 0, n = values.length; i < n; i++) values[i] = JU.PT.parseFloat(list.get(i)); + +return values; +}, "~S,~A"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/CubeReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/CubeReader.js new file mode 100755 index 000000000000..cfad7070cc82 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/CubeReader.js @@ -0,0 +1,37 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.VolumeFileReader"], "J.jvxl.readers.CubeReader", ["JU.PT", "$.SB", "JU.Logger"], function(){ +var c$ = Clazz.declareType(J.jvxl.readers, "CubeReader", J.jvxl.readers.VolumeFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.CubeReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2VFR(sg, br); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +this.jvxlFileHeaderBuffer = new JU.SB(); +this.jvxlFileHeaderBuffer.append(this.rd()).appendC('\n'); +this.jvxlFileHeaderBuffer.append(this.rd()).appendC('\n'); +var atomLine = this.rd(); +var tokens = JU.PT.getTokensAt(atomLine, 0); +this.ac = this.parseIntStr(tokens[0]); +this.negativeAtomCount = (this.ac < 0); +if (this.negativeAtomCount) this.ac = -this.ac; +this.volumetricOrigin.set(this.parseFloatStr(tokens[1]), this.parseFloatStr(tokens[2]), this.parseFloatStr(tokens[3])); +J.jvxl.readers.VolumeFileReader.checkAtomLine(this.isXLowToHigh, this.isAngstroms, tokens[0], atomLine, this.jvxlFileHeaderBuffer); +if (!this.isAngstroms) this.volumetricOrigin.scale(0.5291772); +for (var i = 0; i < 3; ++i) this.readVoxelVector(i); + +for (var i = 0; i < this.ac; ++i) this.jvxlFileHeaderBuffer.append(this.rd() + "\n"); + +if (!this.negativeAtomCount) { +this.nSurfaces = 1; +} else { +this.rd(); +JU.Logger.info("Reading extra CUBE information line: " + this.line); +this.nSurfaces = this.parseIntStr(this.line); +}}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/DelPhiBinaryReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/DelPhiBinaryReader.js new file mode 100755 index 000000000000..acf6849c43ad --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/DelPhiBinaryReader.js @@ -0,0 +1,79 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.VolumeFileReader"], "J.jvxl.readers.DelPhiBinaryReader", ["JU.SB", "$.V3", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.data = null; +this.pt = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "DelPhiBinaryReader", J.jvxl.readers.VolumeFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.DelPhiBinaryReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +var fileName = (sg.getReaderData())[0]; +this.init2VFR(sg, br); +this.binarydoc = this.newBinaryDocument(); +this.setStream(fileName, false); +this.nSurfaces = 1; +if (this.params.thePlane == null) this.params.insideOut = !this.params.insideOut; +this.allowSigma = false; +this.isAngstroms = true; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +var uplbl = this.readString(); +JU.Logger.info(uplbl); +var nxttoplbl = this.readString(); +JU.Logger.info(nxttoplbl); +this.data = this.readFloatArray(); +JU.Logger.info("DelPhi data length: " + this.data.length); +var botlbl = this.readString(); +JU.Logger.info(botlbl); +var scalemid = this.readFloatArray(); +var scale = scalemid[0]; +JU.Logger.info("DelPhi scale: " + scale); +var dx = (scale == 1 ? 0.84375 : 1 / scale); +this.volumetricVectors[0] = JU.V3.new3(0, 0, dx); +this.volumetricVectors[1] = JU.V3.new3(0, dx, 0); +this.volumetricVectors[2] = JU.V3.new3(dx, 0, 0); +JU.Logger.info("DelPhi resolution (pts/angstrom) set to: " + dx); +var nx = 65; +this.voxelCounts[0] = this.voxelCounts[1] = this.voxelCounts[2] = nx; +JU.Logger.info("DelPhi voxel counts: " + nx); +dx *= Clazz.doubleToInt((nx - 1) / 2); +this.volumetricOrigin.set(scalemid[1], scalemid[2], scalemid[3]); +JU.Logger.info("DelPhi center " + this.volumetricOrigin); +this.volumetricOrigin.x -= dx; +this.volumetricOrigin.y -= dx; +this.volumetricOrigin.z -= dx; +this.jvxlFileHeaderBuffer = new JU.SB(); +this.jvxlFileHeaderBuffer.append("DelPhi DATA ").append(nxttoplbl.$replace('\n', ' ').trim()).append("\n\n"); +}); +Clazz.defineMethod(c$, "readString", +function(){ +var n = this.binarydoc.readInt(); +var buf = Clazz.newByteArray (n, 0); +this.binarydoc.readByteArray(buf, 0, n); +this.binarydoc.readInt(); +return String.instantialize(buf); +}); +Clazz.defineMethod(c$, "readFloatArray", +function(){ +var n = this.binarydoc.readInt() >> 2; +var a = Clazz.newFloatArray (n, 0); +for (var i = 0; i < n; i++) a[i] = this.binarydoc.readFloat(); + +this.binarydoc.readInt(); +return a; +}); +Clazz.overrideMethod(c$, "nextVoxel", +function(){ +this.nBytes += 4; +return this.data[this.pt++]; +}); +Clazz.overrideMethod(c$, "skipData", +function(nPoints){ +this.pt += nPoints; +}, "~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/Dsn6BinaryReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/Dsn6BinaryReader.js new file mode 100755 index 000000000000..d2b1a92552e9 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/Dsn6BinaryReader.js @@ -0,0 +1,125 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.MapFileReader"], "J.jvxl.readers.Dsn6BinaryReader", ["java.io.DataInputStream", "JU.Rdr", "$.SB", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.byteFactor = 0; +this.xyCount = 0; +this.nBrickX = 0; +this.nBrickY = 0; +this.brickLayerVoxelCount = 0; +this.brickLayerByteCount = 0; +this.brickRowByteCount = 0; +this.brickLayer = null; +this.pt = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "Dsn6BinaryReader", J.jvxl.readers.MapFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.Dsn6BinaryReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, brNull){ +this.init2MFR(sg, this.br); +this.binarydoc = this.newBinaryDocument(); +var o2 = sg.getReaderData(); +var fileName = o2[0]; +var data = o2[1]; +if (data == null) this.binarydoc.setStream(sg.atomDataServer.getBufferedInputStream(fileName), true); + else this.binarydoc.setStreamData( new java.io.DataInputStream(JU.Rdr.getBIS(data.getBytes())), true); +if (this.params.thePlane == null) this.params.insideOut = !this.params.insideOut; +this.nSurfaces = 1; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +var header = Clazz.newShortArray (19, 0); +for (var i = 0; i < 19; i++) header[i] = this.binarydoc.readShort(); + +if (header[18] != 100) { +this.binarydoc.setStream(null, false); +for (var i = 0; i < 19; i++) header[i] = this.binarydoc.swapBytesS(header[i]); + +}this.xyzStart[0] = header[0]; +this.xyzStart[1] = header[1]; +this.xyzStart[2] = header[2]; +this.n0 = header[3]; +this.n1 = header[4]; +this.n2 = header[5]; +this.na = header[6]; +this.nb = header[7]; +this.nc = header[8]; +this.a = header[9]; +this.b = header[10]; +this.c = header[11]; +this.alpha = header[12]; +this.beta = header[13]; +this.gamma = header[14]; +var header16 = header[15]; +var header17 = header[16]; +var scalingFactor = header[17]; +var header19 = header[18]; +this.maps = 3; +this.mapr = 2; +this.mapc = 1; +this.dmin = (0 - header17) * header19 / header16; +this.dmax = (255 - header17) * header19 / header16; +this.drange = this.dmax - this.dmin; +this.byteFactor = this.drange / 255; +var dminError1 = (0 - header17 - 0.5) * header19 / (header16 - 0.5); +var dminError2 = (0 - header17 + 0.5) * header19 / (header16 + 0.5); +var dmaxError1 = (255 - header17 - 0.5) * header19 / (header16 - 0.5); +var dmaxError2 = (255 - header17 + 0.5) * header19 / (header16 + 0.5); +var dminError = Math.round((dminError2 - dminError1) / 0.002) * 0.001; +var dmaxError = Math.round((dmaxError2 - dmaxError1) / 0.002) * 0.001; +JU.Logger.info("DNS6 dmin,dmax = " + this.dmin + "+/-" + dminError + "," + this.dmax + "+/-" + dmaxError); +this.a /= scalingFactor; +this.b /= scalingFactor; +this.c /= scalingFactor; +this.alpha /= scalingFactor; +this.beta /= scalingFactor; +this.gamma /= scalingFactor; +this.binarydoc.seek(0x200); +this.getVectorsAndOrigin(); +this.setCutoffAutomatic(); +this.xyCount = this.n0 * this.n1; +this.brickLayerVoxelCount = this.xyCount * 8; +this.nBrickX = Clazz.doubleToInt((this.n0 + 7) / 8); +this.nBrickY = Clazz.doubleToInt((this.n1 + 7) / 8); +this.brickRowByteCount = this.nBrickX * 512; +this.brickLayerByteCount = this.brickRowByteCount * this.nBrickY; +this.brickLayer = Clazz.newByteArray (this.brickLayerByteCount, 0); +this.jvxlFileHeaderBuffer = new JU.SB(); +this.jvxlFileHeaderBuffer.append("DNS6/O progressive brick data reader\n"); +this.jvxlFileHeaderBuffer.append("see http://www.uoxray.uoregon.edu/tnt/manual/node104.html\n"); +}); +Clazz.defineMethod(c$, "readBrickLayer", +function(){ +this.binarydoc.readByteArray(this.brickLayer, 0, this.brickLayerByteCount); +this.pt = 0; +this.nBytes = this.binarydoc.getPosition(); +}); +Clazz.defineMethod(c$, "getBrickValue", +function(pt){ +var x = pt % this.n0; +var y = (Clazz.doubleToInt(pt / this.n0)) % this.n1; +var z = Clazz.doubleToInt(pt / this.xyCount); +var brickX = x % 8; +var brickY = y % 8; +var brickZ = z % 8; +var bX = Clazz.doubleToInt(x / 8); +var bY = Clazz.doubleToInt(y / 8); +var bPt = bY * 512 * this.nBrickX + bX * 512 + brickZ * 64 + brickY * 8 + brickX; +if (bPt % 2 == 0) bPt++; + else bPt--; +var value = (this.brickLayer[bPt] + 256) % 256; +return this.dmin + value * this.byteFactor; +}, "~N"); +Clazz.overrideMethod(c$, "nextVoxel", +function(){ +if ((this.pt % this.brickLayerVoxelCount) == 0) this.readBrickLayer(); +return this.getBrickValue(this.pt++); +}); +Clazz.overrideMethod(c$, "skipData", +function(nPoints){ +for (var i = 0; i < nPoints; i++) this.binarydoc.readByte(); + +}, "~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/EfvetReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/EfvetReader.js new file mode 100755 index 000000000000..d408ef41619b --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/EfvetReader.js @@ -0,0 +1,80 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.PolygonFileReader"], "J.jvxl.readers.EfvetReader", ["JU.CU", "$.P3", "J.jvxl.data.JvxlCoder", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.vertexMap = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "EfvetReader", J.jvxl.readers.PolygonFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.EfvetReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2PFR(sg, br); +this.jvxlFileHeaderBuffer.append("efvet file format\nvertices and triangles only\n"); +J.jvxl.data.JvxlCoder.jvxlCreateHeaderWithoutTitleOrAtoms(this.volumeData, this.jvxlFileHeaderBuffer); +this.hasColorData = true; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "getSurfaceData", +function(){ +this.getHeader(); +this.getVertices(); +this.getTriangles(); +JU.Logger.info("efvet file contains " + this.nVertices + " vertices and " + this.nTriangles + " triangles"); +}); +Clazz.defineMethod(c$, "getHeader", +function(){ +this.skipTo("\n"); + +}sb.append(" 0 && this.line.indexOf(">") < 0) this.jvxlFileHeaderBuffer.append("# " + this.line + "\n"); + +JU.Logger.info(this.jvxlFileHeaderBuffer.toString()); +}); +Clazz.defineMethod(c$, "getVertices", +function(){ +var pt = new JU.P3(); +var value = 0; +this.skipTo(" 0 && dataIndex < tokens.length) JU.Logger.info("property " + tokens[dataIndex]); + else JU.Logger.info(this.line); +for (var i = 0; i < this.nVertices; i++) { +this.skipTo(" "); +pt.set(values[0], values[1], values[2]); +this.skipTo(null, "property"); +for (var j = 0; j < dataIndex; j++) value = this.parseFloat(); + +if (this.isAnisotropic) this.setVertexAnisotropy(pt); +var v = this.vertexMap[i + 1] = this.addVC(pt, value, i, true); +if (v >= 0 && this.jvxlData.vertexColors != null) { +this.jvxlData.vertexColors[v] = JU.CU.colorTriadToFFRGB(values[6], values[7], values[8]); +this.jvxlData.nVertexColors++; +}} +}); +Clazz.defineMethod(c$, "getTriangles", +function(){ +this.skipTo(" = 0 && b >= 0 && c >= 0) this.addTriangleCheck(a, b, c, 7, 0, false, 0); +} +}); +Clazz.defineMethod(c$, "getInt", +function(){ +return this.vertexMap[this.parseInt()]; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoFxyReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoFxyReader.js new file mode 100755 index 000000000000..89cb8c795d9b --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoFxyReader.js @@ -0,0 +1,99 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.AtomDataReader"], "J.jvxl.readers.IsoFxyReader", ["JU.SB", "J.jvxl.data.JvxlCoder"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.data = null; +this.isPlanarMapping = false; +this.func = null; +this.values = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "IsoFxyReader", J.jvxl.readers.AtomDataReader); +Clazz.prepareFields (c$, function(){ +this.values = Clazz.newFloatArray (3, 0); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.IsoFxyReader, []); +}); +Clazz.overrideMethod(c$, "init", +function(sg){ +this.initIFR(sg); +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.defineMethod(c$, "initIFR", +function(sg){ +this.initADR(sg); +this.isXLowToHigh = true; +this.precalculateVoxelData = false; +this.params.fullyLit = true; +this.isPlanarMapping = (this.params.thePlane != null || this.params.state == 3); +this.volumeData.sr = (this.params.func == null ? null : this); +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.overrideMethod(c$, "setup", +function(isMapData){ +if (this.params.functionInfo.size() > 5) this.data = this.params.functionInfo.get(5); +this.setupType("functionXY"); +}, "~B"); +Clazz.defineMethod(c$, "setupType", +function(type){ +this.func = this.params.func; +var functionName = this.params.functionInfo.get(0); +this.jvxlFileHeaderBuffer = new JU.SB(); +this.jvxlFileHeaderBuffer.append(type).append("\n").append(functionName).append("\n"); +if (this.params.thePlane != null || this.data == null && !this.useOriginStepsPoints) this.setVolumeForPlane(); + else if (this.data == null) this.setVolumeDataParams(); + else this.setVolumeData(); +J.jvxl.data.JvxlCoder.jvxlCreateHeaderWithoutTitleOrAtoms(this.volumeData, this.jvxlFileHeaderBuffer); +}, "~S"); +Clazz.overrideMethod(c$, "setVolumeData", +function(){ +if (this.data == null) { +this.setVolumeDataADR(); +return; +}this.volumetricOrigin.setT(this.params.functionInfo.get(1)); +for (var i = 0; i < 3; i++) { +var info = this.params.functionInfo.get(i + 2); +this.voxelCounts[i] = Math.abs(Clazz.floatToInt(info.x)); +this.volumetricVectors[i].set(info.y, info.z, info.w); +} +if (this.isAnisotropic) this.setVolumetricAnisotropy(); +}); +Clazz.overrideMethod(c$, "readSurfaceData", +function(isMapData){ +if (this.volumeData.sr != null) return; +this.readSurfaceDataVDR(isMapData); +}, "~B"); +Clazz.overrideMethod(c$, "getPlane", +function(x){ +var plane = this.getPlaneSR(x); +this.setPlane(x, plane); +return plane; +}, "~N"); +Clazz.defineMethod(c$, "setPlane", +function(x, plane){ +for (var y = 0, ptyz = 0; y < this.nPointsY; ++y) for (var z = 0; z < this.nPointsZ; ++z) plane[ptyz++] = this.getValue(x, y, z, 0); + + +}, "~N,~A"); +Clazz.overrideMethod(c$, "getValue", +function(x, y, z, pxyz){ +var value; +if (this.data == null) { +value = this.evaluateValue(x, y, z); +} else { +this.volumeData.voxelPtToXYZ(x, y, z, this.ptTemp); +value = this.data[x][y]; +}return (this.isPlanarMapping ? value : value - this.ptTemp.z); +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "getValueAtPoint", +function(pt, getSource){ +if (this.params.func == null) return 0; +this.values[0] = pt.x; +this.values[1] = pt.y; +this.values[2] = pt.z; +return this.sg.atomDataServer.evalFunctionFloat(this.func[0], this.func[1], this.values); +}, "JU.T3,~B"); +Clazz.defineMethod(c$, "evaluateValue", +function(x, y, z){ +this.volumeData.voxelPtToXYZ(x, y, z, this.ptTemp); +return this.getValueAtPoint(this.ptTemp, false); +}, "~N,~N,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoFxyzReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoFxyzReader.js new file mode 100755 index 000000000000..2ea3123f1920 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoFxyzReader.js @@ -0,0 +1,20 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.IsoFxyReader"], "J.jvxl.readers.IsoFxyzReader", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.$data = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "IsoFxyzReader", J.jvxl.readers.IsoFxyReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.IsoFxyzReader, []); +}); +Clazz.overrideMethod(c$, "setup", +function(isMapData){ +if (this.params.functionInfo.size() > 5) this.$data = this.params.functionInfo.get(5); +this.setupType("functionXYZ"); +}, "~B"); +Clazz.overrideMethod(c$, "getValue", +function(x, y, z, xyz){ +return (this.$data == null ? this.evaluateValue(x, y, z) : this.$data[x][y][z]); +}, "~N,~N,~N,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoIntersectAtomReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoIntersectAtomReader.js new file mode 100755 index 000000000000..9926c80237e4 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoIntersectAtomReader.js @@ -0,0 +1,136 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.AtomDataReader", "JU.BS"], "J.jvxl.readers.IsoIntersectAtomReader", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.myBsA = null; +this.myBsB = null; +this.bsAtomMinMax = null; +this.func = null; +this.funcType = 0; +this.thisPlaneB = null; +this.values = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "IsoIntersectAtomReader", J.jvxl.readers.AtomDataReader); +Clazz.prepareFields (c$, function(){ +this.myBsA = new JU.BS(); +this.myBsB = new JU.BS(); +this.bsAtomMinMax = new Array(2); +this.values = Clazz.newFloatArray (2, 0); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.IsoIntersectAtomReader, []); +}); +Clazz.overrideMethod(c$, "init", +function(sg){ +this.initADR(sg); +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.overrideMethod(c$, "readVolumeParameters", +function(isMapData){ +this.setup(isMapData); +if (isMapData) return false; +this.initializeVolumetricData(); +this.volumeData.setUnitVectors(); +this.thisPlaneB = Clazz.newFloatArray (this.volumeData.getYzCount(), 0); +this.voxelSource = Clazz.newIntArray (this.volumeData.nPoints, 0); +this.vl0 = this.volumeData.volumetricVectorLengths[0]; +this.vl1 = this.volumeData.volumetricVectorLengths[1]; +this.vl2 = this.volumeData.volumetricVectorLengths[2]; +this.getAtomMinMax(this.myBsA, this.bsAtomMinMax[0] = new Array(this.nPointsX)); +this.getAtomMinMax(this.myBsB, this.bsAtomMinMax[1] = new Array(this.nPointsX)); +return true; +}, "~B"); +Clazz.overrideMethod(c$, "setup", +function(isMapData){ +this.setup2(); +this.params.fullyLit = true; +this.point = this.params.point; +if ((typeof(this.params.func)=='string')) { +this.funcType = (this.params.func.equals("a-b") ? 2 : this.params.func.equals("a+b") ? 1 : 3); +} else if (this.params.func == null || this.sg.atomDataServer == null) { +this.funcType = 2; +} else { +this.func = this.params.func; +}if (this.contactPair == null) { +var bsA = this.params.intersection[0]; +var bsB = this.params.intersection[1]; +var bsSelected = new JU.BS(); +bsSelected.or(bsA); +bsSelected.or(bsB); +this.doUseIterator = true; +this.getAtoms(bsSelected, this.doAddHydrogens, true, true, false, false, false, NaN, null); +for (var i = bsA.nextSetBit(0); i >= 0; i = bsA.nextSetBit(i + 1)) this.myBsA.set(this.myIndex[i]); + +for (var i = bsB.nextSetBit(0); i >= 0; i = bsB.nextSetBit(i + 1)) this.myBsB.set(this.myIndex[i]); + +this.setHeader("VDW intersection surface", this.params.calculationType); +this.setRanges(this.params.solvent_ptsPerAngstrom, this.params.solvent_gridMax, 0); +this.margin = 5; +} else { +this.setVolumeData(); +}this.isProgressive = this.isXLowToHigh = true; +}, "~B"); +Clazz.overrideMethod(c$, "getPlane", +function(x){ +if (this.yzCount == 0) { +this.initPlanes(); +}this.thisX = x; +this.thisPlane = this.yzPlanes[x % 2]; +if (this.contactPair == null) { +this.thisAtomSet = this.bsAtomMinMax[0][x]; +this.resetPlane(3.4028235E38); +this.markSphereVoxels(0, this.params.distance); +this.thisPlane = this.thisPlaneB; +this.thisAtomSet = this.bsAtomMinMax[1][x]; +this.resetPlane(3.4028235E38); +this.markSphereVoxels(0, this.params.distance); +} else { +this.markPlaneVoxels(this.contactPair.myAtoms[0], this.contactPair.radii[0]); +this.thisPlane = this.thisPlaneB; +this.markPlaneVoxels(this.contactPair.myAtoms[1], this.contactPair.radii[1]); +}this.thisPlane = this.yzPlanes[x % 2]; +if (!this.setVoxels()) this.resetPlane(0); +if (this.contactPair == null) this.unsetVoxelData(); +return this.thisPlane; +}, "~N"); +Clazz.defineMethod(c$, "setVoxels", +function(){ +for (var i = 0; i < this.yzCount; i++) { +var va = this.thisPlane[i]; +var vb = this.thisPlaneB[i]; +var v = this.getValueAB(va, vb); +if (Float.isNaN(v)) return false; +this.thisPlane[i] = v; +} +return true; +}); +Clazz.defineMethod(c$, "getValueAB", +function(va, vb){ +if (va == 3.4028235E38 || vb == 3.4028235E38 || Float.isNaN(va) || Float.isNaN(vb)) return 3.4028235E38; +switch (this.funcType) { +case 1: +return (va + vb); +case 2: +case 4: +return (va - vb); +case 3: +return (va > vb ? va : vb); +default: +this.values[0] = va; +this.values[1] = vb; +return this.sg.atomDataServer.evalFunctionFloat(this.func[0], this.func[1], this.values); +} +}, "~N,~N"); +Clazz.overrideMethod(c$, "getValueAtPoint", +function(pt, getSource){ +return this.getValueAB(this.getValueAtPoint2(pt, this.myBsA), this.getValueAtPoint2(pt, this.myBsB)); +}, "JU.T3,~B"); +Clazz.defineMethod(c$, "getValueAtPoint2", +function(pt, bs){ +var value = 3.4028235E38; +for (var iAtom = bs.nextSetBit(0); iAtom >= 0; iAtom = bs.nextSetBit(iAtom + 1)) { +var r = pt.distance(this.atomXyzTruncated[iAtom]) - this.atomRadius[iAtom]; +if (r < value) value = r; +} +return (value == 3.4028235E38 ? NaN : value); +}, "JU.T3,JU.BS"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoIntersectGridReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoIntersectGridReader.js new file mode 100755 index 000000000000..8d6cbc8bcbe9 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoIntersectGridReader.js @@ -0,0 +1,41 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.VolumeFileReader"], "J.jvxl.readers.IsoIntersectGridReader", ["JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.readers = null; +this.factors = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "IsoIntersectGridReader", J.jvxl.readers.VolumeFileReader); +Clazz.overrideMethod(c$, "init", +function(sg){ +this.initSR(sg); +var data = sg.getReaderData(); +this.readers = data[0]; +this.factors = data[1]; +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.defineMethod(c$, "readVolumeParameters", +function(isMapData){ +for (var i = this.readers.length; --i >= 0; ) if (!this.readers[i].readVolumeParameters(isMapData)) return false; + +return true; +}, "~B"); +Clazz.defineMethod(c$, "getNextVoxelValue", +function(){ +var f = 0; +for (var i = this.readers.length; --i >= 0; ) f += this.factors[i] * this.readers[i].getNextVoxelValue(); + +return f; +}); +Clazz.overrideMethod(c$, "closeReader", +function(){ +if (this.readerClosed) return; +this.readerClosed = true; +for (var i = this.readers.length; --i >= 0; ) this.readers[i].closeReaderSFR(); + +if (this.nData == 0 || this.dataMax == -3.4028235E38) return; +this.dataMean /= this.nData; +JU.Logger.info("IsoIntersectFileReader closing file: " + this.nData + " points read \ndata min/max/mean = " + this.dataMin + "/" + this.dataMax + "/" + this.dataMean); +}); +Clazz.overrideMethod(c$, "readParameters", +function(){ +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoIntersectReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoIntersectReader.js new file mode 100755 index 000000000000..ccbfc6ab0ef4 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoIntersectReader.js @@ -0,0 +1,136 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.AtomDataReader", "JU.BS"], "J.jvxl.readers.IsoIntersectReader", null, function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.myBsA = null; +this.myBsB = null; +this.bsAtomMinMax = null; +this.func = null; +this.funcType = 0; +this.thisPlaneB = null; +this.values = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "IsoIntersectReader", J.jvxl.readers.AtomDataReader); +Clazz.prepareFields (c$, function(){ +this.myBsA = new JU.BS(); +this.myBsB = new JU.BS(); +this.bsAtomMinMax = new Array(2); +this.values = Clazz.newFloatArray (2, 0); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.IsoIntersectReader, []); +}); +Clazz.overrideMethod(c$, "init", +function(sg){ +this.initADR(sg); +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.overrideMethod(c$, "readVolumeParameters", +function(isMapData){ +this.setup(isMapData); +if (isMapData) return false; +this.initializeVolumetricData(); +this.volumeData.setUnitVectors(); +this.thisPlaneB = Clazz.newFloatArray (this.volumeData.getYzCount(), 0); +this.voxelSource = Clazz.newIntArray (this.volumeData.nPoints, 0); +this.vl0 = this.volumeData.volumetricVectorLengths[0]; +this.vl1 = this.volumeData.volumetricVectorLengths[1]; +this.vl2 = this.volumeData.volumetricVectorLengths[2]; +this.getAtomMinMax(this.myBsA, this.bsAtomMinMax[0] = new Array(this.nPointsX)); +this.getAtomMinMax(this.myBsB, this.bsAtomMinMax[1] = new Array(this.nPointsX)); +return true; +}, "~B"); +Clazz.overrideMethod(c$, "setup", +function(isMapData){ +this.setup2(); +this.params.fullyLit = true; +this.point = this.params.point; +if ((typeof(this.params.func)=='string')) { +this.funcType = (this.params.func.equals("a-b") ? 2 : this.params.func.equals("a+b") ? 1 : 3); +} else if (this.params.func == null || this.sg.atomDataServer == null) { +this.funcType = 2; +} else { +this.func = this.params.func; +}if (this.contactPair == null) { +var bsA = this.params.intersection[0]; +var bsB = this.params.intersection[1]; +var bsSelected = new JU.BS(); +bsSelected.or(bsA); +bsSelected.or(bsB); +this.doUseIterator = true; +this.getAtoms(bsSelected, this.doAddHydrogens, true, true, false, false, false, NaN, null); +for (var i = bsA.nextSetBit(0); i >= 0; i = bsA.nextSetBit(i + 1)) this.myBsA.set(this.myIndex[i]); + +for (var i = bsB.nextSetBit(0); i >= 0; i = bsB.nextSetBit(i + 1)) this.myBsB.set(this.myIndex[i]); + +this.setHeader("VDW intersection surface", this.params.calculationType); +this.setRanges(this.params.solvent_ptsPerAngstrom, this.params.solvent_gridMax, 0); +this.margin = 5; +} else { +this.setVolumeData(); +}this.isProgressive = this.isXLowToHigh = true; +}, "~B"); +Clazz.overrideMethod(c$, "getPlane", +function(x){ +if (this.yzCount == 0) { +this.initPlanes(); +}this.thisX = x; +this.thisPlane = this.yzPlanes[x % 2]; +if (this.contactPair == null) { +this.thisAtomSet = this.bsAtomMinMax[0][x]; +this.resetPlane(3.4028235E38); +this.markSphereVoxels(0, this.params.distance); +this.thisPlane = this.thisPlaneB; +this.thisAtomSet = this.bsAtomMinMax[1][x]; +this.resetPlane(3.4028235E38); +this.markSphereVoxels(0, this.params.distance); +} else { +this.markPlaneVoxels(this.contactPair.myAtoms[0], this.contactPair.radii[0]); +this.thisPlane = this.thisPlaneB; +this.markPlaneVoxels(this.contactPair.myAtoms[1], this.contactPair.radii[1]); +}this.thisPlane = this.yzPlanes[x % 2]; +if (!this.setVoxels()) this.resetPlane(0); +if (this.contactPair == null) this.unsetVoxelData(); +return this.thisPlane; +}, "~N"); +Clazz.defineMethod(c$, "setVoxels", +function(){ +for (var i = 0; i < this.yzCount; i++) { +var va = this.thisPlane[i]; +var vb = this.thisPlaneB[i]; +var v = this.getValueAB(va, vb); +if (Float.isNaN(v)) return false; +this.thisPlane[i] = v; +} +return true; +}); +Clazz.defineMethod(c$, "getValueAB", +function(va, vb){ +if (va == 3.4028235E38 || vb == 3.4028235E38 || Float.isNaN(va) || Float.isNaN(vb)) return 3.4028235E38; +switch (this.funcType) { +case 1: +return (va + vb); +case 2: +case 4: +return (va - vb); +case 3: +return (va > vb ? va : vb); +default: +this.values[0] = va; +this.values[1] = vb; +return this.sg.atomDataServer.evalFunctionFloat(this.func[0], this.func[1], this.values); +} +}, "~N,~N"); +Clazz.overrideMethod(c$, "getValueAtPoint", +function(pt, getSource){ +return this.getValueAB(this.getValueAtPoint2(pt, this.myBsA), this.getValueAtPoint2(pt, this.myBsB)); +}, "JU.T3,~B"); +Clazz.defineMethod(c$, "getValueAtPoint2", +function(pt, bs){ +var value = 3.4028235E38; +for (var iAtom = bs.nextSetBit(0); iAtom >= 0; iAtom = bs.nextSetBit(iAtom + 1)) { +var r = pt.distance(this.atomXyzTruncated[iAtom]) - this.atomRadius[iAtom]; +if (r < value) value = r; +} +return (value == 3.4028235E38 ? NaN : value); +}, "JU.T3,JU.BS"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoMOReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoMOReader.js new file mode 100755 index 000000000000..44483970e71d --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoMOReader.js @@ -0,0 +1,248 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.AtomDataReader"], "J.jvxl.readers.IsoMOReader", ["java.util.Random", "JU.AU", "$.Measure", "$.P3", "$.PT", "$.V3", "J.api.Interface", "J.quantum.QS", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.random = null; +this.points = null; +this.vTemp = null; +this.q = null; +this.mos = null; +this.isNci = false; +this.coef = null; +this.dfCoefMaps = null; +this.linearCombination = null; +this.coefs = null; +this.isElectronDensityCalc = false; +this.mo = null; +this.vDist = null; +this.qSetupDone = false; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "IsoMOReader", J.jvxl.readers.AtomDataReader); +Clazz.prepareFields (c$, function(){ +this.vDist = Clazz.newFloatArray (3, 0); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.IsoMOReader, []); +}); +Clazz.overrideMethod(c$, "init", +function(sg){ +this.initADR(sg); +this.isNci = (this.params.qmOrbitalType == 3); +if (this.isNci) { +this.isXLowToHigh = this.hasColorData = true; +this.precalculateVoxelData = false; +this.params.insideOut = !this.params.insideOut; +}}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.overrideMethod(c$, "setup", +function(isMapData){ +this.mos = this.params.moData.get("mos"); +this.linearCombination = this.params.qm_moLinearCombination; +this.mo = (this.mos != null && this.linearCombination == null ? this.mos.get(this.params.qm_moNumber - 1) : null); +var haveVolumeData = this.params.moData.containsKey("haveVolumeData"); +if (haveVolumeData && this.mo != null) this.params.volumeData = this.mo.get("volumeData"); +this.setup2(); +this.doAddHydrogens = false; +this.getAtoms(this.params.bsSelected, this.doAddHydrogens, !this.isNci, this.isNci, this.isNci, false, false, this.params.qm_marginAngstroms, (this.isNci ? null : this.params.modelInvRotation)); +var className; +if (this.isNci) { +className = "quantum.NciCalculation"; +this.setHeader("NCI (promolecular)", "see NCIPLOT: A Program for Plotting Noncovalent Interaction Regions, Julia Contreras-Garcia, et al., J. of Chemical Theory and Computation, 2011, 7, 625-632"); +} else { +className = "quantum.MOCalculation"; +this.setHeader("MO", "calculation type: " + this.params.moData.get("calculationType")); +}this.setRanges(this.params.qm_ptsPerAngstrom, this.params.qm_gridMax, 0); +if (haveVolumeData) { +for (var i = this.params.title.length; --i >= 0; ) this.fixTitleLine(i, this.mo); + +} else { +this.q = J.api.Interface.getOption(className, this.sg.atomDataServer, "file"); +if (this.isNci) { +this.qpc = this.q; +} else { +if (this.linearCombination == null) { +for (var i = this.params.title.length; --i >= 0; ) this.fixTitleLine(i, this.mo); + +this.coef = this.mo.get("coefficients"); +this.dfCoefMaps = this.mo.get("dfCoefMaps"); +} else { +this.coefs = JU.AU.newFloat2(this.mos.size()); +for (var i = 1; i < this.linearCombination.length; i += 2) { +var j = Clazz.floatToInt(this.linearCombination[i]); +if (j > this.mos.size() || j < 1) return; +this.coefs[j - 1] = this.mos.get(j - 1).get("coefficients"); +} +for (var i = this.params.title.length; --i >= 0; ) this.fixTitleLine(i, null); + +}}this.isElectronDensityCalc = (this.coef == null && this.linearCombination == null && !this.isNci); +}this.volumeData.sr = null; +if (isMapData && !this.isElectronDensityCalc && !haveVolumeData) { +this.volumeData.doIterate = false; +this.volumeData.setVoxelDataAsArray(this.voxelData = Clazz.newFloatArray (1, 1, 1, 0)); +this.volumeData.sr = this; +this.points = new Array(1); +this.points[0] = new JU.P3(); +if (!this.setupCalculation()) this.q = null; +} else if (this.params.psi_monteCarloCount > 0) { +this.vertexDataOnly = true; +this.random = new java.util.Random(this.params.randomSeed); +}}, "~B"); +Clazz.overrideMethod(c$, "readVolumeParameters", +function(isMapData){ +this.setup(isMapData); +if (this.volumeData.sr == null) this.initializeVolumetricData(); +return true; +}, "~B"); +Clazz.defineMethod(c$, "fixTitleLine", +function(iLine, mo){ +if (this.params.title == null) return; +var line = this.params.title[iLine]; +if (line.indexOf(" MO ") >= 0) { +var nboType = this.params.moData.get("nboType"); +if (nboType != null) line = JU.PT.rep(line, " MO ", " " + nboType + " "); +}if (line.indexOf("%M") >= 0) line = this.params.title[iLine] = JU.PT.formatStringS(line, "M", this.atomData.modelName); +if (line.indexOf("%F") >= 0) line = this.params.title[iLine] = JU.PT.formatStringS(line, "F", JU.PT.rep(this.params.fileName, "DROP_", "")); +var pt = line.indexOf("%"); +if (line.length == 0 || pt < 0) return; +var rep = 0; +if (line.indexOf("%I") >= 0) line = JU.PT.formatStringS(line, "I", this.params.qm_moLinearCombination == null ? "" + this.params.qm_moNumber : J.quantum.QS.getMOString(this.params.qm_moLinearCombination)); +if (line.indexOf("%N") >= 0) line = JU.PT.formatStringS(line, "N", "" + this.params.qmOrbitalCount); +var energy = null; +if (mo == null) { +for (var i = 0; i < this.linearCombination.length; i += 2) if (this.linearCombination[i] != 0) { +mo = this.mos.get(Clazz.floatToInt(this.linearCombination[i + 1]) - 1); +var e = mo.get("energy"); +if (energy == null) { +if (e == null) break; +energy = e; +} else if (!energy.equals(e)) { +energy = null; +break; +}} +} else { +if (mo.containsKey("energy")) energy = mo.get("energy"); +}if (line.indexOf("%E") >= 0) { +line = JU.PT.formatStringS(line, "E", energy != null && ++rep != 0 ? "" + energy : ""); +} else if (energy != null) { +var s = JU.PT.formatStringF(line, "E", energy.floatValue()); +if (s !== line) { +line = s; +rep++; +}}if (line.indexOf("%U") >= 0) line = JU.PT.formatStringS(line, "U", energy != null && this.params.moData.containsKey("energyUnits") && ++rep != 0 ? this.params.moData.get("energyUnits") : ""); +if (line.indexOf("%S") >= 0) line = JU.PT.formatStringS(line, "S", mo != null && mo.containsKey("symmetry") && ++rep != 0 ? "" + mo.get("symmetry") : ""); +if (line.indexOf("%O") >= 0) { +var obj = (mo == null ? null : mo.get("occupancy")); +var o = (obj == null ? 0 : obj.floatValue()); +line = JU.PT.formatStringS(line, "O", obj != null && this.params.qm_moLinearCombination == null && ++rep != 0 ? (o == Clazz.floatToInt(o) ? "" + Clazz.floatToInt(o) : JU.PT.formatF(o, 0, 4, false, false)) : ""); +}if (line.indexOf("%T") >= 0) line = JU.PT.formatStringS(line, "T", mo != null && mo.containsKey("type") ? (this.params.qm_moLinearCombination == null && ++rep != 0 ? "" + mo.get("type") : "") + ((this.params.isSquared || this.params.isSquaredLinear) && ++rep != 0 ? " ^2" : "") : ""); +if (line.equals("string")) { +this.params.title[iLine] = ""; +return; +}var isOptional = (line.indexOf("?") == 0); +this.params.title[iLine] = (!isOptional ? line : rep > 0 && !line.trim().endsWith("=") ? line.substring(1) : ""); +}, "~N,java.util.Map"); +Clazz.overrideMethod(c$, "readSurfaceData", +function(isMapData){ +if (this.volumeData.sr != null) return; +if (this.params.psi_monteCarloCount <= 0) { +this.readSurfaceDataVDR(isMapData); +return; +}if (this.points != null) return; +this.points = new Array(1000); +for (var j = 0; j < 1000; j++) this.points[j] = new JU.P3(); + +if (this.params.thePlane != null) this.vTemp = new JU.V3(); +for (var i = 0; i < 3; i++) this.vDist[i] = this.volumeData.volumetricVectorLengths[i] * this.volumeData.voxelCounts[i]; + +this.volumeData.setVoxelDataAsArray(this.voxelData = Clazz.newFloatArray (1000, 1, 1, 0)); +this.getValues(); +var value; +var f = 0; +for (var j = 0; j < 1000; j++) if ((value = Math.abs(this.voxelData[j][0][0])) > f) f = value; + +if (f < 0.0001) return; +for (var i = 0; i < this.params.psi_monteCarloCount; ) { +this.getValues(); +for (var j = 0; j < 1000; j++) { +value = this.voxelData[j][0][0]; +var absValue = Math.abs(value); +if (absValue <= this.getRnd(f)) continue; +this.addVC(this.points[j], value, 0, false); +if (++i == this.params.psi_monteCarloCount) break; +} +} +}, "~B"); +Clazz.overrideMethod(c$, "postProcessVertices", +function(){ +}); +Clazz.defineMethod(c$, "getValues", +function(){ +for (var j = 0; j < 1000; j++) { +this.voxelData[j][0][0] = 0; +this.points[j].set(this.volumeData.volumetricOrigin.x + this.getRnd(this.vDist[0]), this.volumeData.volumetricOrigin.y + this.getRnd(this.vDist[1]), this.volumeData.volumetricOrigin.z + this.getRnd(this.vDist[2])); +if (this.params.thePlane != null) JU.Measure.getPlaneProjection(this.points[j], this.params.thePlane, this.points[j], this.vTemp); +} +this.createOrbital(); +}); +Clazz.overrideMethod(c$, "getValueAtPoint", +function(pt, getSource){ +return (this.q == null ? 0 : this.q.processPt(pt)); +}, "JU.T3,~B"); +Clazz.defineMethod(c$, "getRnd", +function(f){ +return this.random.nextFloat() * f; +}, "~N"); +Clazz.overrideMethod(c$, "generateCube", +function(){ +if (this.params.volumeData != null) return; +this.newVoxelDataCube(); +this.createOrbital(); +}); +Clazz.defineMethod(c$, "createOrbital", +function(){ +var isMonteCarlo = (this.params.psi_monteCarloCount > 0); +if (this.isElectronDensityCalc) { +if (this.mos == null || isMonteCarlo) return; +System.out.println("createOrbital " + this.params.qm_moNumber); +for (var i = this.params.qm_moNumber; --i >= 0; ) { +JU.Logger.info(" generating isosurface data for MO " + (i + 1)); +var mo = this.mos.get(i); +this.coef = mo.get("coefficients"); +this.dfCoefMaps = mo.get("dfCoefMaps"); +if (!this.setupCalculation()) return; +this.q.createCube(); +} +} else { +if (!isMonteCarlo) JU.Logger.info("generating isosurface data for MO using cutoff " + this.params.cutoff); +if (!this.setupCalculation()) return; +this.q.createCube(); +this.jvxlData.integration = this.q.getIntegration(); +if (this.mo != null) this.mo.put("integration", Float.$valueOf(this.jvxlData.integration)); +}}); +Clazz.overrideMethod(c$, "getPlane", +function(x){ +if (!this.qSetupDone) this.setupCalculation(); +return this.getPlaneSR(x); +}, "~N"); +Clazz.defineMethod(c$, "setupCalculation", +function(){ +this.qSetupDone = true; +switch (this.params.qmOrbitalType) { +case 5: +break; +case 2: +case 1: +return (this.q).setupCalculation(this.params.moData, this.params.qmOrbitalType == 2, this.volumeData, this.bsMySelected, this.atomData.xyz, this.atomData.atoms, this.atomData.firstAtomIndex, this.dfCoefMaps, this.coef, this.linearCombination, this.params.isSquaredLinear, this.coefs, this.points); +case 3: +return (this.q).setupCalculation(this.volumeData, this.bsMySelected, this.params.bsSolvent, this.atomData.bsMolecules, this.atomData.atoms, this.atomData.firstAtomIndex, true, this.points, this.params.parameters, this.params.testFlags); +} +return false; +}); +Clazz.overrideMethod(c$, "getSurfacePointAndFraction", +function(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, ptReturn){ +var zero = this.getSPF(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, ptReturn); +if (this.q != null && !Float.isNaN(zero)) { +zero = this.q.processPt(ptReturn); +if (this.params.isSquared) zero *= zero; +}return zero; +}, "~N,~B,~N,~N,JU.T3,JU.V3,~N,~N,~N,~N,~N,~A,JU.T3"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoMepReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoMepReader.js new file mode 100755 index 000000000000..4a252e7ca47f --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoMepReader.js @@ -0,0 +1,34 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.AtomDataReader"], "J.jvxl.readers.IsoMepReader", ["J.api.Interface"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.type = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "IsoMepReader", J.jvxl.readers.AtomDataReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.IsoMepReader, []); +}); +Clazz.overrideMethod(c$, "init", +function(sg){ +this.initIMR(sg); +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.defineMethod(c$, "initIMR", +function(sg){ +this.initADR(sg); +this.type = "Mep"; +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.overrideMethod(c$, "setup", +function(isMapData){ +this.setup2(); +this.doAddHydrogens = false; +this.getAtoms(this.params.bsSelected, this.doAddHydrogens, true, false, false, false, false, this.params.mep_marginAngstroms, null); +this.setHeader("MEP", ""); +this.setRanges(this.params.mep_ptsPerAngstrom, this.params.mep_gridMax, 0); +}, "~B"); +Clazz.overrideMethod(c$, "generateCube", +function(){ +this.newVoxelDataCube(); +var m = J.api.Interface.getOption("quantum." + this.type + "Calculation", this.sg.atomDataServer, "file"); +m.calculate(this.volumeData, this.bsMySelected, this.atomData.xyz, this.atomData.atoms, this.params.theProperty, this.params.mep_calcType); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoMlpReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoMlpReader.js new file mode 100755 index 000000000000..7dea26bb4df0 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoMlpReader.js @@ -0,0 +1,14 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.IsoMepReader"], "J.jvxl.readers.IsoMlpReader", null, function(){ +var c$ = Clazz.declareType(J.jvxl.readers, "IsoMlpReader", J.jvxl.readers.IsoMepReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.IsoMlpReader, []); +}); +Clazz.overrideMethod(c$, "init", +function(sg){ +this.initIMR(sg); +this.type = "Mlp"; +}, "J.jvxl.readers.SurfaceGenerator"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoPlaneReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoPlaneReader.js new file mode 100755 index 000000000000..2634aecb144d --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoPlaneReader.js @@ -0,0 +1,21 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.AtomDataReader"], "J.jvxl.readers.IsoPlaneReader", null, function(){ +var c$ = Clazz.declareType(J.jvxl.readers, "IsoPlaneReader", J.jvxl.readers.AtomDataReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.IsoPlaneReader, []); +}); +Clazz.overrideMethod(c$, "init", +function(sg){ +this.initADR(sg); +this.precalculateVoxelData = false; +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.overrideMethod(c$, "setup", +function(isMapData){ +this.setup2(); +this.setHeader("PLANE", this.params.thePlane.toString()); +this.params.cutoff = 0; +this.setVolumeForPlane(); +}, "~B"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoShapeReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoShapeReader.js new file mode 100755 index 000000000000..f1472bb32e3c --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoShapeReader.js @@ -0,0 +1,375 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.VolumeDataReader", "JU.P3"], "J.jvxl.readers.IsoShapeReader", ["java.util.Random", "JU.Measure", "$.SB", "$.V3", "J.jvxl.data.JvxlCoder", "JU.Logger", "$.MeshSurface"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.psi_n = 2; +this.psi_l = 1; +this.psi_m = 1; +this.psi_Znuc = 1; +this.sphere_radiusAngstroms = 0; +this.monteCarloCount = 0; +this.random = null; +this.allowNegative = true; +this.rfactor = null; +this.pfactor = null; +this.radius = 0; +this.ptPsi = null; +this.psi_normalization = 0; +this.aoMax = 0; +this.aoMax2 = 0; +this.angMax2 = 0; +this.planeU = null; +this.planeV = null; +this.planeCenter = null; +this.planeRadius = 0; +this.rnl = 0; +this.surfaceDone = false; +this.nTries = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "IsoShapeReader", J.jvxl.readers.VolumeDataReader); +Clazz.prepareFields (c$, function(){ +this.rfactor = Clazz.newDoubleArray (10, 0); +this.pfactor = Clazz.newDoubleArray (10, 0); +this.ptPsi = new JU.P3(); +this.psi_normalization = 1 / (2 * Math.sqrt(3.141592653589793)); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.IsoShapeReader, []); +}); +Clazz.overrideMethod(c$, "init", +function(sg){ +this.initVDR(sg); +var o = sg.getReaderData(); +if (Clazz.instanceOf(o, Float)) { +this.sphere_radiusAngstroms = (o).floatValue(); +} else { +this.sphere_radiusAngstroms = 0; +var data = o; +this.psi_n = Clazz.floatToInt(data[0]); +this.psi_l = Clazz.floatToInt(data[1]); +this.psi_m = Clazz.floatToInt(data[2]); +this.psi_Znuc = data[3]; +this.monteCarloCount = Clazz.floatToInt(data[4]); +}}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.overrideMethod(c$, "setup", +function(isMapData){ +this.volumeData.sr = this; +this.precalculateVoxelData = false; +this.isQuiet = true; +if (Float.isNaN(this.center.x)) this.center.set(0, 0, 0); +var type = "sphere"; +switch (this.dataType) { +case 1294: +this.calcFactors(this.psi_n, this.psi_l, this.psi_m); +this.autoScaleOrbital(); +this.ptsPerAngstrom = 5; +this.maxGrid = 40; +type = "hydrogen-like orbital"; +if (this.monteCarloCount > 0) { +this.vertexDataOnly = true; +this.random = new java.util.Random(this.params.randomSeed); +} else { +this.isQuiet = false; +}break; +case 70: +case 71: +type = "lp"; +this.vertexDataOnly = true; +this.radius = 0; +this.ptsPerAngstrom = 1; +this.maxGrid = 1; +break; +case 68: +this.allowNegative = false; +this.calcFactors(this.psi_n, this.psi_l, this.psi_m); +this.psi_normalization = 1; +this.radius = 1.1 * this.eccentricityRatio * this.eccentricityScale; +if (this.eccentricityScale > 0 && this.eccentricityScale < 1) this.radius /= this.eccentricityScale; +this.ptsPerAngstrom = 10; +this.maxGrid = 21; +type = "lobe"; +break; +case 67: +type = "ellipsoid(thermal)"; +this.radius = 3.0 * this.sphere_radiusAngstroms; +this.ptsPerAngstrom = 10; +this.maxGrid = 22; +break; +case 74: +if (!isMapData && this.monteCarloCount == 0) break; +type = "geodesic"; +case 66: +if (type.equals("sphere")) type = "ellipsoid"; +case 65: +default: +this.radius = 1.2 * this.sphere_radiusAngstroms * this.eccentricityScale; +this.ptsPerAngstrom = 10; +this.maxGrid = 22; +break; +} +if (this.monteCarloCount == 0) this.setVolumeData(); +this.setHeader(type + "\n"); +}, "~B"); +Clazz.overrideMethod(c$, "setVolumeData", +function(){ +this.setVoxelRange(0, -this.radius, this.radius, this.ptsPerAngstrom, this.maxGrid, 0); +this.setVoxelRange(1, -this.radius, this.radius, this.ptsPerAngstrom, this.maxGrid, 0); +if (this.allowNegative) this.setVoxelRange(2, -this.radius, this.radius, this.ptsPerAngstrom, this.maxGrid, 0); + else this.setVoxelRange(2, 0, this.radius / this.eccentricityRatio, this.ptsPerAngstrom, this.maxGrid, 0); +}); +Clazz.overrideMethod(c$, "getValue", +function(x, y, z, ptyz){ +this.volumeData.voxelPtToXYZ(x, y, z, this.ptPsi); +return this.getValueAtPoint(this.ptPsi, false); +}, "~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "getValueAtPoint", +function(pt, getSource){ +this.ptTemp.sub2(pt, this.center); +if (this.isEccentric) this.eccentricityMatrixInverse.rotate(this.ptTemp); +if (this.isAnisotropic) { +this.ptTemp.x /= this.anisotropy[0]; +this.ptTemp.y /= this.anisotropy[1]; +this.ptTemp.z /= this.anisotropy[2]; +}if (this.sphere_radiusAngstroms > 0) { +if (this.params.anisoB != null) { +return this.sphere_radiusAngstroms - Math.sqrt(this.ptTemp.x * this.ptTemp.x + this.ptTemp.y * this.ptTemp.y + this.ptTemp.z * this.ptTemp.z) / (Math.sqrt(this.params.anisoB[0] * this.ptTemp.x * this.ptTemp.x + this.params.anisoB[1] * this.ptTemp.y * this.ptTemp.y + this.params.anisoB[2] * this.ptTemp.z * this.ptTemp.z + this.params.anisoB[3] * this.ptTemp.x * this.ptTemp.y + this.params.anisoB[4] * this.ptTemp.x * this.ptTemp.z + this.params.anisoB[5] * this.ptTemp.y * this.ptTemp.z)); +}return this.sphere_radiusAngstroms - Math.sqrt(this.ptTemp.x * this.ptTemp.x + this.ptTemp.y * this.ptTemp.y + this.ptTemp.z * this.ptTemp.z); +}var value = this.hydrogenAtomPsi(this.ptTemp); +if (Math.abs(value) < 1.0E-7) value = 0; +return (this.allowNegative || value >= 0 ? value : 0); +}, "JU.T3,~B"); +Clazz.defineMethod(c$, "setHeader", +function(line1){ +this.jvxlFileHeaderBuffer = new JU.SB(); +this.jvxlFileHeaderBuffer.append(line1); +if (this.sphere_radiusAngstroms > 0) { +this.jvxlFileHeaderBuffer.append(" rad=").appendF(this.sphere_radiusAngstroms); +} else { +this.jvxlFileHeaderBuffer.append(" n=").appendI(this.psi_n).append(", l=").appendI(this.psi_l).append(", m=").appendI(this.psi_m).append(" Znuc=").appendF(this.psi_Znuc).append(" res=").appendF(this.ptsPerAngstrom).append(" rad=").appendF(this.radius); +}this.jvxlFileHeaderBuffer.append(this.isAnisotropic ? " anisotropy=(" + this.anisotropy[0] + "," + this.anisotropy[1] + "," + this.anisotropy[2] + ")\n" : "\n"); +J.jvxl.data.JvxlCoder.jvxlCreateHeaderWithoutTitleOrAtoms(this.volumeData, this.jvxlFileHeaderBuffer); +}, "~S"); +Clazz.defineMethod(c$, "calcFactors", +function(n, el, m){ +var abm = Math.abs(m); +var NnlLnl = Math.pow(2 * this.psi_Znuc / n / 0.52918, 1.5) * Math.sqrt(J.jvxl.readers.IsoShapeReader.fact[n - el - 1] * J.jvxl.readers.IsoShapeReader.fact[n + el] / 2 / n); +var Plm = Math.pow(2, -el) * J.jvxl.readers.IsoShapeReader.fact[el] * J.jvxl.readers.IsoShapeReader.fact[el + abm] * Math.sqrt((2 * el + 1) * J.jvxl.readers.IsoShapeReader.fact[el - abm] / 2 / J.jvxl.readers.IsoShapeReader.fact[el + abm]); +for (var p = 0; p <= n - el - 1; p++) this.rfactor[p] = NnlLnl / J.jvxl.readers.IsoShapeReader.fact[p] / J.jvxl.readers.IsoShapeReader.fact[n - el - p - 1] / J.jvxl.readers.IsoShapeReader.fact[2 * el + p + 1]; + +for (var p = abm; p <= el; p++) this.pfactor[p] = Math.pow(-1, el - p) * Plm / J.jvxl.readers.IsoShapeReader.fact[p] / J.jvxl.readers.IsoShapeReader.fact[el + abm - p] / J.jvxl.readers.IsoShapeReader.fact[el - p] / J.jvxl.readers.IsoShapeReader.fact[p - abm]; + +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "autoScaleOrbital", +function(){ +this.aoMax = 0; +var rmax = 0; +this.aoMax2 = 0; +var rmax2 = 0; +var d; +if (this.params.distance == 0) { +for (var ir = 0; ir < 1000; ir++) { +var r = ir / 10; +d = Math.abs(this.radialPart(r)); +if (JU.Logger.debugging) JU.Logger.debug("R\t" + r + "\t" + d); +if (d >= this.aoMax) { +rmax = r; +this.aoMax = d; +}d *= d * r * r; +if (d >= this.aoMax2) { +rmax2 = r; +this.aoMax2 = d; +}} +} else { +this.aoMax = Math.abs(this.radialPart(this.params.distance)); +this.aoMax2 = this.aoMax * this.aoMax * this.params.distance * this.params.distance; +rmax = rmax2 = this.params.distance; +}JU.Logger.info("Atomic Orbital radial max = " + this.aoMax + " at " + rmax); +JU.Logger.info("Atomic Orbital r2R2 max = " + this.aoMax2 + " at " + rmax2); +if (this.monteCarloCount >= 0) { +this.angMax2 = 0; +for (var ang = 0; ang < 180; ang += 1) { +var th = ang / (6.283185307179586); +d = Math.abs(this.angularPart(th, 0, 0)); +if (JU.Logger.debugging) JU.Logger.debug("A\t" + ang + "\t" + d); +if (d > this.angMax2) { +this.angMax2 = d; +}} +this.angMax2 *= this.angMax2; +if (this.psi_m != 0) { +this.angMax2 *= 2; +}JU.Logger.info("Atomic Orbital phi^2theta^2 max = " + this.angMax2); +}var min; +if (this.params.cutoff == 0) { +min = (this.monteCarloCount > 0 ? this.aoMax * 0.01 : 0.01); +} else if (this.monteCarloCount > 0) { +this.aoMax = Math.abs(this.params.cutoff); +min = this.aoMax * 0.01; +} else { +min = Math.abs(this.params.cutoff / 2); +if (this.params.isSquared) min = Math.sqrt(min / 2); +}var r0 = 0; +for (var ir = 1000; --ir >= 0; ir -= 1) { +var r = ir / 10; +d = Math.abs(this.radialPart(r)); +if (d >= min) { +r0 = r; +break; +}} +this.radius = r0 + (this.monteCarloCount == 0 ? 1 : 0); +if (this.isAnisotropic) { +var aMax = 0; +for (var i = 3; --i >= 0; ) if (this.anisotropy[i] > aMax) aMax = this.anisotropy[i]; + +this.radius *= aMax; +}JU.Logger.info("Atomic Orbital radial extent set to " + this.radius + " for cutoff " + this.params.cutoff); +if (this.params.thePlane != null && this.monteCarloCount > 0) { +this.planeCenter = new JU.P3(); +this.planeU = new JU.V3(); +JU.Measure.getPlaneProjection(this.center, this.params.thePlane, this.planeCenter, this.planeU); +this.planeU.set(this.params.thePlane.x, this.params.thePlane.y, this.params.thePlane.z); +this.planeU.normalize(); +this.planeV = JU.V3.new3(1, 0, 0); +if (Math.abs(this.planeU.dot(this.planeV)) > 0.5) this.planeV.set(0, 1, 0); +this.planeV.cross(this.planeU, this.planeV); +this.planeU.cross(this.planeU, this.planeV); +this.aoMax2 = 0; +d = this.center.distance(this.planeCenter); +if (d < this.radius) { +this.planeRadius = Math.sqrt(this.radius * this.radius - d * d); +var ir = Clazz.floatToInt(this.planeRadius * 10); +for (var ix = -ir; ix <= ir; ix++) for (var iy = -ir; iy <= ir; iy++) { +this.ptPsi.setT(this.planeU); +this.ptPsi.scale(ix / 10); +this.ptPsi.scaleAdd2(iy / 10, this.planeV, this.ptPsi); +d = this.hydrogenAtomPsi(this.ptPsi); +d = Math.abs(this.hydrogenAtomPsi(this.ptPsi)); +if (d > this.aoMax2) this.aoMax2 = d; +} + +if (this.aoMax2 < 0.001) this.aoMax2 = 0; + else this.aoMax2 *= this.aoMax2; +}}}); +Clazz.defineMethod(c$, "radialPart", +function(r){ +var rho = 2 * this.psi_Znuc * r / this.psi_n / 0.52918; +var sum = 0; +for (var p = 0; p <= this.psi_n - this.psi_l - 1; p++) sum += Math.pow(-rho, p) * this.rfactor[p]; + +return Math.exp(-rho / 2) * Math.pow(rho, this.psi_l) * sum; +}, "~N"); +Clazz.defineMethod(c$, "hydrogenAtomPsi", +function(pt){ +var x2y2 = pt.x * pt.x + pt.y * pt.y; +this.rnl = this.radialPart(Math.sqrt(x2y2 + pt.z * pt.z)); +var ph = Math.atan2(pt.y, pt.x); +var th = Math.atan2(Math.sqrt(x2y2), pt.z); +var theta_lm_phi_m = this.angularPart(th, ph, this.psi_m); +return this.rnl * theta_lm_phi_m; +}, "JU.P3"); +Clazz.defineMethod(c$, "angularPart", +function(th, ph, m){ +var cth = Math.cos(th); +var sth = Math.sin(th); +var isS = (m == 0 && this.psi_l == 0); +var abm = Math.abs(m); +var sum = 0; +if (isS) sum = this.pfactor[0]; + else for (var p = abm; p <= this.psi_l; p++) sum += (p == abm ? 1 : Math.pow(1 + cth, p - abm)) * (p == this.psi_l ? 1 : Math.pow(1 - cth, this.psi_l - p)) * this.pfactor[p]; + +var theta_lm = (abm == 0 ? sum : Math.abs(Math.pow(sth, abm)) * sum); +var phi_m; +if (m == 0) phi_m = 1; + else if (m > 0) phi_m = Math.cos(m * ph) * 1.414214; + else phi_m = Math.sin(m * ph) * 1.414214; +return (Math.abs(phi_m) < 0.0000000001 ? 0 : theta_lm * phi_m * this.psi_normalization); +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "createMonteCarloOrbital", +function(){ +if (this.surfaceDone || this.aoMax2 == 0 || this.params.distance > this.radius) return; +var isS = (this.psi_m == 0 && this.psi_l == 0); +this.surfaceDone = true; +var value; +var rave = 0; +this.nTries = 0; +for (var i = 0; i < this.monteCarloCount; this.nTries++) { +if (this.params.thePlane == null) { +var r; +if (this.params.distance == 0) { +r = this.random.nextDouble() * this.radius; +var rp = r * this.radialPart(r); +if (rp * rp <= this.aoMax2 * this.random.nextDouble()) continue; +} else { +r = this.params.distance; +}var u = this.random.nextDouble(); +var v = this.random.nextDouble(); +var theta = 2 * 3.141592653589793 * u; +var cosPhi = 2 * v - 1; +if (!isS) { +var phi = Math.acos(cosPhi); +var ap = this.angularPart(phi, theta, this.psi_m); +if (ap * ap <= this.angMax2 * this.random.nextDouble()) continue; +}var sinPhi = Math.sin(Math.acos(cosPhi)); +var x = r * Math.cos(theta) * sinPhi; +var y = r * Math.sin(theta) * sinPhi; +var z = r * cosPhi; +this.ptPsi.set(x, y, z); +this.ptPsi.add(this.center); +value = this.getValueAtPoint(this.ptPsi, false); +} else { +this.ptPsi.setT(this.planeU); +this.ptPsi.scale(this.random.nextFloat() * this.planeRadius * 2 - this.planeRadius); +this.ptPsi.scaleAdd2(this.random.nextFloat() * this.planeRadius * 2 - this.planeRadius, this.planeV, this.ptPsi); +this.ptPsi.add(this.planeCenter); +value = this.getValueAtPoint(this.ptPsi, false); +if (value * value <= this.aoMax2 * this.random.nextFloat()) continue; +}rave += this.ptPsi.distance(this.center); +this.addVC(this.ptPsi, value, 0, true); +i++; +} +if (this.params.distance == 0) JU.Logger.info("Atomic Orbital mean radius = " + rave / this.monteCarloCount + " for " + this.monteCarloCount + " points (" + this.nTries + " tries)"); +}); +Clazz.overrideMethod(c$, "readSurfaceData", +function(isMapData){ +switch (this.params.dataType) { +case 1294: +if (this.monteCarloCount <= 0) break; +this.createMonteCarloOrbital(); +return; +case 70: +case 71: +this.ptPsi.set(0, 0, this.eccentricityScale / 2); +this.eccentricityMatrixInverse.rotate(this.ptPsi); +this.ptPsi.add(this.center); +this.addVC(this.center, 0, 0, true); +this.addVC(this.ptPsi, 0, 0, true); +this.addTriangleCheck(0, 0, 0, 0, 0, false, 0); +return; +case 74: +if (!isMapData) { +this.createGeodesic(); +return; +}} +this.readSurfaceDataVDR(isMapData); +}, "~B"); +Clazz.defineMethod(c$, "createGeodesic", +function(){ +var ms = JU.MeshSurface.getSphereData(4); +var pts = ms.altVertices; +for (var i = 0; i < pts.length; i++) { +var pt = JU.P3.newP(pts[i]); +pt.scale(this.params.distance); +pt.add(this.center); +this.addVC(pt, 0, i, false); +} +var faces = ms.pis; +for (var i = 0; i < faces.length; i++) { +var face = faces[i]; +this.addTriangleCheck(face[0], face[1], face[2], 7, 7, false, 0); +} +}); +c$.fact = Clazz.newFloatArray (20, 0); +{ +J.jvxl.readers.IsoShapeReader.fact[0] = 1; +for (var i = 1; i < 20; i++) J.jvxl.readers.IsoShapeReader.fact[i] = J.jvxl.readers.IsoShapeReader.fact[i - 1] * i; + +}}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoSolventReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoSolventReader.js new file mode 100755 index 000000000000..0cafd9467172 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/IsoSolventReader.js @@ -0,0 +1,633 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["JU.P3", "J.jvxl.readers.AtomDataReader", "JU.P4", "$.V3"], "J.jvxl.readers.IsoSolventReader", ["java.util.Hashtable", "JU.BS", "$.Lst", "$.Measure", "J.jvxl.data.MeshData", "JU.BSUtil", "$.Logger", "$.MeshSurface", "$.TempArray"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.cavityRadius = 0; +this.envelopeRadius = 0; +this.dots = null; +this.doCalculateTroughs = false; +this.isCavity = false; +this.isPocket = false; +this.iter = null; +this.bsSurfacePoints = null; +this.bsSurfaceDone = null; +this.bsLocale = null; +this.htEdges = null; +this.vEdges = null; +this.vFaces = null; +this.ptS1 = null; +this.ptS2 = null; +this.vTemp = null; +this.plane = null; +this.ptTemp2 = null; +this.vTemp2 = null; +this.p = null; +this.bsAtomMinMax = null; +this.isSurfacePoint = false; +this.iAtomSurface = 0; +this.nTest = 0; +if (!Clazz.isClassDefined("J.jvxl.readers.IsoSolventReader.Edge")) { +J.jvxl.readers.IsoSolventReader.$IsoSolventReader$Edge$ (); +} +if (!Clazz.isClassDefined("J.jvxl.readers.IsoSolventReader.Face")) { +J.jvxl.readers.IsoSolventReader.$IsoSolventReader$Face$ (); +} +this.rAS = 0; +this.rBS = 0; +this.rAS2 = 0; +this.rBS2 = 0; +this.dAB = 0; +this.dAB2 = 0; +this.ecosASB2 = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "IsoSolventReader", J.jvxl.readers.AtomDataReader); +Clazz.prepareFields (c$, function(){ +this.ptS1 = new JU.P3(); +this.ptS2 = new JU.P3(); +this.vTemp = new JU.V3(); +this.plane = new JU.P4(); +this.ptTemp2 = new JU.P3(); +this.vTemp2 = new JU.V3(); +this.p = new JU.P3(); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.IsoSolventReader, []); +}); +Clazz.overrideMethod(c$, "init", +function(sg){ +this.initADR(sg); +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.overrideMethod(c$, "readVolumeParameters", +function(isMapData){ +this.setup(isMapData); +this.initializeVolumetricData(); +this.volumeData.setUnitVectors(); +this.vl0 = this.volumeData.volumetricVectorLengths[0]; +this.vl1 = this.volumeData.volumetricVectorLengths[1]; +this.vl2 = this.volumeData.volumetricVectorLengths[2]; +if (this.isProgressive) { +this.volumeData.getYzCount(); +this.bsAtomMinMax = new Array(this.nPointsX); +this.getAtomMinMax(null, this.bsAtomMinMax); +this.voxelSource = Clazz.newIntArray (this.volumeData.nPoints, 0); +}return true; +}, "~B"); +Clazz.overrideMethod(c$, "setup", +function(isMapData){ +this.setup2(); +if (this.contactPair == null) { +this.cavityRadius = this.params.cavityRadius; +this.envelopeRadius = this.params.envelopeRadius; +this.sr = this.params.solventRadius; +this.point = this.params.point; +this.isCavity = (this.params.isCavity && this.meshDataServer != null); +this.isPocket = (this.params.pocket != null && this.meshDataServer != null); +this.doCalculateTroughs = (!isMapData && this.sg.atomDataServer != null && !this.isCavity && this.sr > 0 && (this.dataType == 1195 || this.dataType == 1203)); +this.doUseIterator = this.doCalculateTroughs; +this.getAtoms(this.params.bsSelected, this.doAddHydrogens, true, false, false, true, false, NaN, null); +if (this.isCavity || this.isPocket) this.dots = this.meshDataServer.calculateGeodesicSurface(this.bsMySelected, this.envelopeRadius); +this.setHeader("solvent/molecular surface", this.params.calculationType); +if (this.havePlane || !isMapData) { +var r = Math.max(this.params.solventExtendedAtomRadius, this.params.solventRadius); +var minPtsPerAng = (r >= 1 ? 1.5 / r : 0); +if (minPtsPerAng > 0) System.out.println("IsoSolventReader.minPtsPerAng=" + minPtsPerAng); +this.setRanges(this.params.solvent_ptsPerAngstrom, this.params.solvent_gridMax, minPtsPerAng); +this.volumeData.getYzCount(); +this.margin = this.volumeData.maxGrid * 2.0; +}if (this.bsNearby != null) this.bsMySelected.or(this.bsNearby); +} else if (!isMapData) { +this.setVolumeData(); +}if (!this.doCalculateTroughs) { +if (isMapData) { +this.precalculateVoxelData = false; +this.volumeData.sr = this; +} else if (!this.isCavity) { +this.isProgressive = this.isXLowToHigh = true; +}}if (this.thisAtomSet == null) this.thisAtomSet = JU.BSUtil.setAll(this.myAtomCount); +}, "~B"); +Clazz.overrideMethod(c$, "generateCube", +function(){ +if (this.isCavity && this.params.theProperty != null) return; +if (this.isCavity && this.dataType != 1207 && this.dataType != 1208) { +this.params.vertexSource = null; +this.newVoxelDataCube(); +this.resetVoxelData(3.4028235E38); +this.markSphereVoxels(this.cavityRadius, this.params.distance); +this.generateSolventCavity(); +this.resetVoxelData(3.4028235E38); +this.markSphereVoxels(0, NaN); +} else { +this.voxelSource = Clazz.newIntArray (this.volumeData.nPoints, 0); +this.generateSolventCube(); +}this.unsetVoxelData(); +var info = this.params.slabInfo; +if (info != null) for (var i = 0; i < info.size(); i++) if ((info.get(i)[2]).booleanValue() && Clazz.instanceOf(info.get(i)[0],"JU.P4")) { +this.volumeData.capData(info.get(i)[0], this.params.cutoff); +info.removeItemAt(i--); +} +}); +Clazz.overrideMethod(c$, "getSurfacePointAndFraction", +function(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA0, vB0, fReturn, ptReturn){ +var vA = this.marchingCubes.getLinearOffset(x, y, z, vA0); +var vB = this.marchingCubes.getLinearOffset(x, y, z, vB0); +this.isSurfacePoint = (this.bsSurfaceVoxels != null && (this.bsSurfaceVoxels.get(vA) || this.bsSurfaceVoxels.get(vB))); +if (this.voxelSource != null) { +var vs = Math.abs(Float.isNaN(valueB) || valueA < valueB ? this.voxelSource[vA] : this.voxelSource[vB]); +if (vs > 0) this.iAtomSurface = this.atomIndex[vs - 1]; +}if (J.jvxl.readers.IsoSolventReader.testLinear || this.voxelSource == null || this.voxelSource[vA] == 0 || this.voxelSource[vA] != this.voxelSource[vB]) return this.getSPF(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, ptReturn); +var fraction = fReturn[0] = JU.MeshSurface.getSphericalInterpolationFraction((this.voxelSource[vA] < 0 ? this.sr : this.atomRadius[this.voxelSource[vA] - 1]), valueA, valueB, edgeVector.length()); +ptReturn.scaleAdd2(fraction, edgeVector, pointA); +var diff = valueB - valueA; +return valueA + fraction * diff; +}, "~N,~B,~N,~N,JU.T3,JU.V3,~N,~N,~N,~N,~N,~A,JU.T3"); +Clazz.overrideMethod(c$, "addVertexCopy", +function(vertexXYZ, value, assocVertex, asCopy){ +var i = this.addVC(vertexXYZ, value, assocVertex, asCopy); +if (i < 0) return i; +if (this.isSurfacePoint) this.bsSurfacePoints.set(i); +if (this.params.vertexSource != null) this.params.vertexSource[i] = this.iAtomSurface; +return i; +}, "JU.T3,~N,~N,~B"); +Clazz.overrideMethod(c$, "selectPocket", +function(doExclude){ +if (this.meshDataServer != null) this.meshDataServer.fillMeshData(this.meshData, 1, null); +var v = this.meshData.vs; +var nVertices = this.meshData.vc; +var vv = this.meshData.vvs; +var nDots = this.dots.length; +for (var i = 0; i < nVertices; i++) { +for (var j = 0; j < nDots; j++) { +if (this.dots[j].distance(v[i]) < this.envelopeRadius) { +vv[i] = NaN; +continue; +}} +} +this.meshData.getSurfaceSet(); +var nSets = this.meshData.nSets; +var pocketSet = JU.BS.newN(nSets); +var ss; +for (var i = 0; i < nSets; i++) if ((ss = this.meshData.surfaceSet[i]) != null) for (var j = ss.nextSetBit(0); j >= 0; j = ss.nextSetBit(j + 1)) if (Float.isNaN(this.meshData.vvs[j])) { +pocketSet.set(i); +break; +} + +for (var i = 0; i < nSets; i++) if (this.meshData.surfaceSet[i] != null && pocketSet.get(i) == doExclude) this.meshData.invalidateSurfaceSet(i); + +this.updateSurfaceData(); +if (!doExclude) this.meshData.surfaceSet = null; +if (this.meshDataServer != null) { +this.meshDataServer.fillMeshData(this.meshData, 3, null); +this.meshData = new J.jvxl.data.MeshData(); +}}, "~B"); +Clazz.overrideMethod(c$, "postProcessVertices", +function(){ +this.setVertexSource(); +if (this.doCalculateTroughs && this.bsSurfacePoints != null) { +var bsAll = new JU.BS(); +var bsSurfaces = this.meshData.getSurfaceSet(); +var bsSources = null; +var volumes = (this.isPocket ? null : J.jvxl.data.MeshData.calculateVolumeOrArea(this.meshData, null, false, false)); +var minVolume = (this.isCavity ? (1.5 * 3.141592653589793 * Math.pow(this.sr, 3)) : 0); +var maxVolume = 0; +var maxIsNegative = false; +if (volumes != null && !this.isCavity) for (var i = 0; i < this.meshData.nSets; i++) { +var v = volumes[i]; +if (Math.abs(v) > maxVolume) { +maxVolume = Math.abs(v); +maxIsNegative = (v < 0); +}} +var factor = (maxIsNegative ? -1 : 1); +for (var i = 0; i < this.meshData.nSets; i++) { +var bss = bsSurfaces[i]; +if (bss.intersects(this.bsSurfacePoints)) { +if (volumes == null || volumes[i] * factor > minVolume) if (this.params.vertexSource != null) { +var bs = new JU.BS(); +if (bsSources == null) bsSources = new Array(bsSurfaces.length); +for (var j = bss.nextSetBit(0); j >= 0; j = bss.nextSetBit(j + 1)) { +var iatom = this.params.vertexSource[j]; +if (iatom < 0) continue; +if (bsAll.get(iatom)) { +this.meshData.invalidateSurfaceSet(i); +break; +}bs.set(iatom); +} +bsAll.or(bs); +continue; +}}this.meshData.invalidateSurfaceSet(i); +} +this.updateSurfaceData(); +if (this.meshDataServer != null) { +this.meshDataServer.fillMeshData(this.meshData, 3, null); +this.meshData = new J.jvxl.data.MeshData(); +}}if (this.params.thePlane != null && this.params.slabInfo == null) this.params.addSlabInfo(JU.TempArray.getSlabWithinRange(-100, 0)); +}); +Clazz.defineMethod(c$, "generateSolventCavity", +function(){ +var bs = JU.BS.newN(this.nPointsX * this.nPointsY * this.nPointsZ); +var i = 0; +var nDots = this.dots.length; +var n = 0; +var d; +var r2 = this.envelopeRadius; +for (var x = 0; x < this.nPointsX; ++x) for (var y = 0; y < this.nPointsY; ++y) { +out : for (var z = 0; z < this.nPointsZ; ++z, ++i) if ((d = this.voxelData[x][y][z]) < 3.4028235E38 && d >= this.cavityRadius) { +this.volumeData.voxelPtToXYZ(x, y, z, this.ptV); +for (var j = 0; j < nDots; j++) { +if (this.dots[j].distance(this.ptV) < r2) continue out; +} +bs.set(i); +n++; +} +} + +JU.Logger.info("cavities include " + n + " voxel points"); +this.atomRadius = Clazz.newFloatArray (n, 0); +this.atomXyzTruncated = new Array(n); +for (var x = 0, ipt = 0, apt = 0; x < this.nPointsX; ++x) for (var y = 0; y < this.nPointsY; ++y) for (var z = 0; z < this.nPointsZ; ++z) if (bs.get(ipt++)) { +this.volumeData.voxelPtToXYZ(x, y, z, (this.atomXyzTruncated[apt] = new JU.P3())); +this.atomRadius[apt++] = this.voxelData[x][y][z]; +} + + +this.myAtomCount = this.firstNearbyAtom = n; +this.thisAtomSet = JU.BSUtil.setAll(this.myAtomCount); +this.rs = null; +this.setRadii(); +}); +Clazz.defineMethod(c$, "generateSolventCube", +function(){ +if (this.dataType == 1207) return; +this.params.vertexSource = Clazz.newIntArray (this.volumeData.nPoints, 0); +this.bsSurfaceDone = new JU.BS(); +this.bsSurfaceVoxels = new JU.BS(); +this.bsSurfacePoints = new JU.BS(); +if (this.doCalculateTroughs) { +this.iter = this.sg.atomDataServer.getSelectedAtomIterator(this.bsMySelected, true, false, false); +this.vEdges = new JU.Lst(); +this.bsLocale = new Array(this.myAtomCount); +this.htEdges = new java.util.Hashtable(); +this.getEdges(); +JU.Logger.info(this.vEdges.size() + " edges"); +this.vFaces = new JU.Lst(); +this.getFaces(); +JU.Logger.info(this.vFaces.size() + " faces"); +this.bsLocale = null; +this.htEdges = null; +this.iter.release(); +this.iter = null; +this.newVoxelDataCube(); +this.resetVoxelData(3.4028235E38); +this.markFaceVoxels(true); +this.markToroidVoxels(); +this.validSpheres.or(this.noFaceSpheres); +this.vEdges = null; +this.markFaceVoxels(false); +this.vFaces = null; +} else { +this.newVoxelDataCube(); +this.resetVoxelData(3.4028235E38); +}this.markSphereVoxels(0, this.doCalculateTroughs ? 3.4028235E38 : this.params.distance); +this.noFaceSpheres = null; +this.validSpheres = null; +}); +Clazz.defineMethod(c$, "getEdges", +function(){ +for (var iatomA = 0; iatomA < this.myAtomCount; iatomA++) this.bsLocale[iatomA] = new JU.BS(); + +for (var iatomA = 0; iatomA < this.myAtomCount; iatomA++) { +var ptA = this.atomXyzTruncated[iatomA]; +var rA = this.rs[iatomA]; +this.sg.atomDataServer.setIteratorForAtom(this.iter, this.atomIndex[iatomA], rA + this.maxRS); +while (this.iter.hasNext()) { +var iB = this.iter.next(); +var iatomB = this.myIndex[iB]; +if (iatomA >= this.firstNearbyAtom && iatomB >= this.firstNearbyAtom) continue; +var ptB = this.atomXyzTruncated[iatomB]; +var rB = this.rs[iatomB]; +var dAB = ptA.distance(ptB); +if (dAB >= rA + rB) continue; +var edge = Clazz.innerTypeInstance(J.jvxl.readers.IsoSolventReader.Edge, this, null, this, iatomA, iatomB, dAB); +this.vEdges.addLast(edge); +this.bsLocale[iatomA].set(iatomB); +this.bsLocale[iatomB].set(iatomA); +this.htEdges.put(edge.toString(), edge); +} +} +}); +Clazz.defineMethod(c$, "findEdge", +function(i, j){ +return this.htEdges.get(i < j ? i + "_" + j : j + "_" + i); +}, "~N,~N"); +Clazz.defineMethod(c$, "getFaces", +function(){ +var bs = new JU.BS(); +this.params.surfaceAtoms = this.validSpheres = new JU.BS(); +this.noFaceSpheres = JU.BSUtil.setAll(this.myAtomCount); +for (var i = this.vEdges.size(); --i >= 0; ) { +var edge = this.vEdges.get(i); +var ia = edge.ia; +var ib = edge.ib; +bs.clearAll(); +bs.or(this.bsLocale[ia]); +bs.and(this.bsLocale[ib]); +for (var ic = bs.nextSetBit(ib + 1); ic >= 0; ic = bs.nextSetBit(ic + 1)) { +if (this.getSolventPoints(edge, ia, ib, ic)) { +var f; +var isOK = false; +if ((f = this.validateFace(ia, ib, ic, edge, this.ptS1)) != null) { +this.vFaces.addLast(f); +isOK = true; +}if ((f = this.validateFace(ia, ib, ic, edge, this.ptS2)) != null) { +this.vFaces.addLast(f); +isOK = true; +}if (isOK) { +this.noFaceSpheres.clear(ia); +this.noFaceSpheres.clear(ib); +this.noFaceSpheres.clear(ic); +}}} +} +}); +Clazz.defineMethod(c$, "validateFace", +function(ia, ib, ic, edge, ptS){ +this.sg.atomDataServer.setIteratorForPoint(this.iter, this.modelIndex, ptS, this.maxRS); +var isValid = true; +while (this.iter.hasNext()) { +var iia = this.iter.next(); +var iatom = this.myIndex[iia]; +if (iatom == ia || iatom == ib || iatom == ic) continue; +var d = this.atomData.atoms[iia].distance(ptS); +if (d < this.atomData.atomRadius[iia] + this.sr) { +isValid = false; +break; +}} +var bc = this.findEdge(ib, ic); +var ca = this.findEdge(ia, ic); +var f = (isValid ? Clazz.innerTypeInstance(J.jvxl.readers.IsoSolventReader.Face, this, null, ia, ib, ic, ptS) : null); +edge.addFace(f); +bc.addFace(f); +ca.addFace(f); +if (!isValid) return null; +this.validSpheres.set(ia); +this.validSpheres.set(ib); +this.validSpheres.set(ic); +return f; +}, "~N,~N,~N,J.jvxl.readers.IsoSolventReader.Edge,JU.P3"); +Clazz.defineMethod(c$, "markFaceVoxels", +function(firstPass){ +var bsThisPass = new JU.BS(); +var v0 = this.volumetricVectors[0]; +var v1 = this.volumetricVectors[1]; +var v2 = this.volumetricVectors[2]; +for (var fi = this.vFaces.size(); --fi >= 0; ) { +var f = this.vFaces.get(fi); +var ptA = this.atomXyzTruncated[f.ia]; +var ptB = this.atomXyzTruncated[f.ib]; +var ptC = this.atomXyzTruncated[f.ic]; +var ptS = f.pS; +this.setGridLimitsForAtom(ptS, this.sr, this.pt0, this.pt1); +this.volumeData.voxelPtToXYZ(this.pt0.x, this.pt0.y, this.pt0.z, this.ptV); +for (var i = this.pt0.x; i < this.pt1.x; i++, this.ptV.add2(v0, this.ptY0)) { +this.ptY0.setT(this.ptV); +for (var j = this.pt0.y; j < this.pt1.y; j++, this.ptV.add2(v1, this.ptZ0)) { +this.ptZ0.setT(this.ptV); +for (var k = this.pt0.z; k < this.pt1.z; k++, this.ptV.add(v2)) { +var value = this.sr - this.ptV.distance(ptS); +var v = this.voxelData[i][j][k]; +var ipt = this.volumeData.getPointIndex(i, j, k); +if (firstPass && value > 0) this.bsSurfaceDone.set(ipt); +if (JU.Measure.isInTetrahedron(this.ptV, ptA, ptB, ptC, ptS, this.plane, this.vTemp, this.vTemp2, false)) { +if (!firstPass ? !this.bsSurfaceDone.get(ipt) && value < 0 && value > -this.volumeData.maxGrid * 1.8 && (value > v) == bsThisPass.get(ipt) : (value > 0 && (v < 0 || v == 3.4028235E38 || (value > v) == bsThisPass.get(ipt)))) { +bsThisPass.set(ipt); +this.setVoxel(i, j, k, ipt, value); +if (this.voxelSource != null) this.voxelSource[ipt] = -1 - f.ia; +if (value > 0) { +this.bsSurfaceVoxels.set(ipt); +}}}} +} +} +} +}, "~B"); +Clazz.defineMethod(c$, "markToroidVoxels", +function(){ +var v0 = this.volumetricVectors[0]; +var v1 = this.volumetricVectors[1]; +var v2 = this.volumetricVectors[2]; +for (var ei = this.vEdges.size(); --ei >= 0; ) { +var edge = this.vEdges.get(ei); +if (!edge.isValid()) continue; +var ia = edge.ia; +var ib = edge.ib; +var ptA = this.atomXyzTruncated[ia]; +var ptB = this.atomXyzTruncated[ib]; +this.rAS = this.rs[ia]; +this.rBS = this.rs[ib]; +this.rAS2 = this.rs2[ia]; +this.rBS2 = this.rs2[ib]; +this.dAB = edge.d; +this.dAB2 = edge.d2; +this.ecosASB2 = edge.cosASB2; +this.setGridLimitsForAtom(edge, edge.maxr, this.pt0, this.pt1); +this.volumeData.voxelPtToXYZ(this.pt0.x, this.pt0.y, this.pt0.z, this.ptV); +for (var i = this.pt0.x; i < this.pt1.x; i++, this.ptV.add2(v0, this.ptY0)) { +this.ptY0.setT(this.ptV); +for (var j = this.pt0.y; j < this.pt1.y; j++, this.ptV.add2(v1, this.ptZ0)) { +this.ptZ0.setT(this.ptV); +for (var k = this.pt0.z; k < this.pt1.z; k++, this.ptV.add(v2)) { +var dVS = this.checkSpecialVoxel(ptA, ptB, this.ptV); +if (Float.isNaN(dVS)) continue; +var value = this.sr - dVS; +if (value < this.voxelData[i][j][k]) { +var ipt = this.volumeData.getPointIndex(i, j, k); +this.setVoxel(i, j, k, ipt, value); +if (this.voxelSource != null) this.voxelSource[ipt] = -1 - ia; +}} +} +} +} +}); +Clazz.overrideMethod(c$, "unsetVoxelData", +function(){ +if (!this.havePlane) { +this.unsetVoxelData2(); +return; +}if (this.isProgressive) for (var i = 0; i < this.yzCount; i++) { +if (this.thisPlane[i] < 0.001) { +} else { +this.thisPlane[i] = 0.001; +}} + else for (var x = 0; x < this.nPointsX; ++x) for (var y = 0; y < this.nPointsY; ++y) for (var z = 0; z < this.nPointsZ; ++z) if (this.voxelData[x][y][z] < 0.001) { +} else { +this.voxelData[x][y][z] = 0.001; +} + + +}); +Clazz.defineMethod(c$, "getSolventPoints", +function(edge, ia, ib, ic){ +var rAS = this.rs[ia]; +var v = edge.v; +var cosAngleBAS = (edge.d2 + this.rs2[ia] - this.rs2[ib]) / (2 * edge.d * rAS); +var angleBAS = Math.acos(cosAngleBAS); +this.p.scaleAdd2(cosAngleBAS * rAS, v, this.atomXyzTruncated[ia]); +JU.Measure.getPlaneThroughPoint(this.p, v, this.plane); +var dPS = (Math.sin(angleBAS) * rAS); +var ptC = this.atomXyzTruncated[ic]; +var rCS = this.rs[ic]; +var dCT = JU.Measure.distanceToPlane(this.plane, ptC); +if (Math.abs(dCT) >= rCS * 0.9) return false; +this.ptTemp.scaleAdd2(-dCT, v, ptC); +var dpT = this.p.distance(this.ptTemp); +var dsp2 = dPS * dPS; +var dST2 = this.rs2[ic] - dCT * dCT; +var cosTheta = (dsp2 + dpT * dpT - dST2) / (2 * dPS * dpT); +if (Math.abs(cosTheta) >= 0.99) return false; +var vXS = this.vTemp2; +vXS.sub2(this.ptTemp, this.p); +vXS.normalize(); +this.ptTemp.scaleAdd2(dPS * cosTheta, vXS, this.p); +vXS.cross(v, vXS); +vXS.normalize(); +vXS.scale((Math.sqrt(1 - cosTheta * cosTheta) * dPS)); +this.ptS1.add2(this.ptTemp, vXS); +this.ptS2.sub2(this.ptTemp, vXS); +return true; +}, "J.jvxl.readers.IsoSolventReader.Edge,~N,~N,~N"); +Clazz.defineMethod(c$, "checkSpecialVoxel", +function(ptA, ptB, ptV){ +var dAV = ptA.distance(ptV); +var dAV2 = ptA.distanceSquared(ptV); +var f = this.rAS / dAV; +if (f > 1) { +this.p.set(ptA.x + (ptV.x - ptA.x) * f, ptA.y + (ptV.y - ptA.y) * f, ptA.z + (ptV.z - ptA.z) * f); +return (ptB.distanceSquared(this.p) >= this.rBS2 ? NaN : this.solventDistance(this.rAS, this.rAS2, this.rBS2, dAV, dAV2, ptB.distanceSquared(ptV))); +}var dBV = ptB.distance(ptV); +if ((f = this.rBS / dBV) > 1) { +this.p.set(ptB.x + (ptV.x - ptB.x) * f, ptB.y + (ptV.y - ptB.y) * f, ptB.z + (ptV.z - ptB.z) * f); +return (ptA.distanceSquared(this.p) >= this.rAS2 ? NaN : this.solventDistance(this.rBS, this.rBS2, this.rAS2, dBV, dBV * dBV, dAV2)); +}return NaN; +}, "JU.P3,JU.P3,JU.P3"); +Clazz.defineMethod(c$, "solventDistance", +function(rAS, rAS2, rBS2, dAV, dAV2, dBV2){ +var angleVAB = Math.acos((dAV2 + this.dAB2 - dBV2) / (2 * dAV * this.dAB)); +var angleSAB = Math.acos((rAS2 + this.dAB2 - rBS2) / (2 * rAS * this.dAB)); +var dVS2 = (rAS2 + dAV2 - 2 * rAS * dAV * Math.cos(angleSAB - angleVAB)); +var dVS = Math.sqrt(dVS2); +return (this.ecosASB2 < (rAS2 + dVS2 - dAV * dAV) / (dVS * rAS) ? dVS : NaN); +}, "~N,~N,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "dumpLine", +function(pt1, pt2, label, color){ +this.sg.log("draw ID \"x" + label + (this.nTest++) + "\" " + JU.P3.newP(pt1) + " " + JU.P3.newP(pt2) + " color " + color); +}, "JU.P3,JU.T3,~S,~S"); +Clazz.defineMethod(c$, "dumpLine2", +function(pt1, pt2, label, d, color1, color2){ +var pt = new JU.V3(); +pt.setT(pt2); +pt.sub(pt1); +pt.normalize(); +pt.scale(d); +pt.add(pt1); +this.sg.log("draw ID \"" + label + (this.nTest++) + "\" " + JU.P3.newP(pt1) + " " + JU.P3.newP(pt) + " color " + color1); +this.sg.log("draw ID \"" + label + (this.nTest++) + "\"" + JU.P3.newP(pt) + " " + JU.P3.newP(pt2) + " color " + color2 + "\"" + label + "\""); +}, "JU.P3,JU.P3,~S,~N,~S,~S"); +Clazz.defineMethod(c$, "dumpPoint", +function(pt, label, color){ +this.sg.log("draw ID \"" + label + (this.nTest++) + "\"" + JU.P3.newP(pt) + " color " + color); +}, "JU.P3,~S,~S"); +Clazz.overrideMethod(c$, "getValueAtPoint", +function(pt, getSource){ +if (this.contactPair != null) return pt.distance(this.contactPair.myAtoms[1]) - this.contactPair.radii[1]; +var value = 3.4028235E38; +for (var iAtom = 0; iAtom < this.firstNearbyAtom; iAtom++) { +var r = pt.distance(this.atomXyzTruncated[iAtom]) - this.rs[iAtom]; +if (r < value) value = r; +} +return (value == 3.4028235E38 ? NaN : value); +}, "JU.T3,~B"); +Clazz.overrideMethod(c$, "discardTempData", +function(discardAll){ +this.rs = null; +this.rs2 = null; +this.discardTempDataSR(discardAll); +}, "~B"); +Clazz.overrideMethod(c$, "getPlane", +function(x){ +if (this.yzCount == 0) { +this.initPlanes(); +}this.thisX = x; +this.thisPlane = this.yzPlanes[x % 2]; +if (this.contactPair == null) { +this.resetPlane(3.4028235E38); +this.thisAtomSet = this.bsAtomMinMax[x]; +this.markSphereVoxels(0, this.params.distance); +this.unsetVoxelData(); +} else { +this.markPlaneVoxels(this.contactPair.myAtoms[0], this.contactPair.radii[0]); +}return this.thisPlane; +}, "~N"); +c$.$IsoSolventReader$Edge$ = function(){ +/*if4*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +Clazz.prepareCallback(this, arguments); +this.ia = 0; +this.ib = 0; +this.nFaces = 0; +this.nInvalid = 0; +this.d = 0; +this.d2 = 0; +this.maxr = 0; +this.cosASB2 = 0; +this.v = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers.IsoSolventReader, "Edge", JU.P3); +Clazz.overrideConstructor(c$, +function(r, ia, ib, d){ +this.ia = Math.min(ia, ib); +this.ib = Math.max(ia, ib); +this.d = d; +this.d2 = d * d; +this.maxr = Math.sqrt(this.d2 / 4 + Math.max(r.rs2[ia], r.rs2[ib])); +this.ave(r.atomXyzTruncated[ia], r.atomXyzTruncated[ib]); +this.cosASB2 = (r.rs2[ia] + r.rs2[ib] - this.d2) / (r.rs[ib] * r.rs[ia]); +this.v = JU.V3.newVsub(r.atomXyzTruncated[ib], r.atomXyzTruncated[ia]); +this.v.normalize(); +}, "J.jvxl.readers.IsoSolventReader,~N,~N,~N"); +Clazz.defineMethod(c$, "addFace", +function(f){ +this.nFaces++; +if (f == null) { +this.nInvalid++; +return; +}}, "J.jvxl.readers.IsoSolventReader.Face"); +Clazz.defineMethod(c$, "isValid", +function(){ +return (this.nFaces == 0 || this.nInvalid != this.nFaces); +}); +Clazz.overrideMethod(c$, "toString", +function(){ +return this.ia + "_" + this.ib; +}); +/*eoif4*/})(); +}; +c$.$IsoSolventReader$Face$ = function(){ +/*if4*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +Clazz.prepareCallback(this, arguments); +this.ia = 0; +this.ib = 0; +this.ic = 0; +this.pS = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers.IsoSolventReader, "Face", null); +Clazz.makeConstructor(c$, +function(ia, ib, ic, pS){ +this.ia = ia; +this.ib = ib; +this.ic = ic; +this.pS = JU.P3.newP(pS); +}, "~N,~N,~N,JU.P3"); +Clazz.overrideMethod(c$, "toString", +function(){ +return this.ia + "_" + this.ib + "_" + this.ic + "_" + this.pS; +}); +/*eoif4*/})(); +}; +c$.testLinear = false; +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/JaguarReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/JaguarReader.js new file mode 100755 index 000000000000..085f348f2022 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/JaguarReader.js @@ -0,0 +1,56 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.VolumeFileReader"], "J.jvxl.readers.JaguarReader", ["JU.PT", "$.SB"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.extents = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "JaguarReader", J.jvxl.readers.VolumeFileReader); +Clazz.prepareFields (c$, function(){ +this.extents = Clazz.newFloatArray (3, 0); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.JaguarReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2VFR(sg, br); +this.nSurfaces = 1; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +this.jvxlFileHeaderBuffer = new JU.SB(); +this.jvxlFileHeaderBuffer.append("Jaguar data\n"); +this.jvxlFileHeaderBuffer.append("\n"); +var atomLine; +while ((atomLine = this.rd()) != null && atomLine.indexOf("origin=") < 0) { +} +var tokens = JU.PT.getTokensAt(atomLine, 0); +if (tokens.length == 4 && tokens[0].equals("origin=")) { +this.volumetricOrigin.set(this.parseFloatStr(tokens[1]), this.parseFloatStr(tokens[2]), this.parseFloatStr(tokens[3])); +J.jvxl.readers.VolumeFileReader.checkAtomLine(this.isXLowToHigh, this.isAngstroms, "0", "0 " + tokens[1] + " " + tokens[2] + " " + tokens[3], this.jvxlFileHeaderBuffer); +if (!this.isAngstroms) this.volumetricOrigin.scale(0.5291772); +}this.readExtents(0); +this.readExtents(1); +this.readExtents(2); +tokens = JU.PT.getTokens(this.rd()); +this.voxelCounts[0] = this.parseIntStr(tokens[1]); +this.voxelCounts[1] = this.parseIntStr(tokens[2]); +this.voxelCounts[2] = this.parseIntStr(tokens[3]); +var factor = (this.isAngstroms ? 1 : 0.5291772); +var d = this.extents[0] / (this.voxelCounts[0] - 1); +this.volumetricVectors[0].set(d * factor, 0, 0); +this.jvxlFileHeaderBuffer.append(this.voxelCounts[0] + " " + d + " 0.0 0.0\n"); +d = this.extents[1] / (this.voxelCounts[1] - 1); +this.volumetricVectors[1].set(0, d * factor, 0); +this.jvxlFileHeaderBuffer.append(this.voxelCounts[1] + " 0.0 " + d + " 0.0\n"); +d = this.extents[2] / (this.voxelCounts[2] - 1); +this.volumetricVectors[2].set(0, 0, d * factor); +this.jvxlFileHeaderBuffer.append(this.voxelCounts[2] + " 0.0 0.0 " + d + "\n"); +this.rd(); +}); +Clazz.defineMethod(c$, "readExtents", +function(voxelVectorIndex){ +var tokens = JU.PT.getTokens(this.rd()); +this.extents[voxelVectorIndex] = this.parseFloatStr(tokens[voxelVectorIndex + 1]); +}, "~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/JvxlReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/JvxlReader.js new file mode 100755 index 000000000000..4995b5cb715b --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/JvxlReader.js @@ -0,0 +1,195 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.JvxlXmlReader"], "J.jvxl.readers.JvxlReader", ["JU.P4", "$.PT", "$.SB", "J.jvxl.data.JvxlCoder", "J.jvxl.readers.VolumeFileReader", "JU.C", "$.Escape", "$.Logger"], function(){ +var c$ = Clazz.declareType(J.jvxl.readers, "JvxlReader", J.jvxl.readers.JvxlXmlReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.JvxlReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2JXR(sg, br); +this.isXmlFile = false; +this.JVXL_VERSION = "2.0"; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +this.jvxlFileHeaderBuffer = new JU.SB().append(this.skipComments(false)); +if (this.line == null || this.line.length == 0) this.line = "Line 1"; +this.jvxlFileHeaderBuffer.append(this.line).appendC('\n'); +if (this.rd() == null || this.line.length == 0) this.line = "Line 2"; +this.jvxlFileHeaderBuffer.append(this.line).appendC('\n'); +this.jvxlFileHeaderBuffer.append(this.skipComments(false)); +var atomLine = this.line; +var tokens = JU.PT.getTokensAt(atomLine, 0); +this.isXLowToHigh = false; +this.negativeAtomCount = true; +this.ac = 0; +if (tokens[0] === "-0") { +} else if (tokens[0].charAt(0) == '+') { +this.isXLowToHigh = true; +this.ac = this.parseIntStr(tokens[0].substring(1)); +} else { +this.ac = -this.parseIntStr(tokens[0]); +}if (this.ac == -2147483648) return; +this.volumetricOrigin.set(this.parseFloatStr(tokens[1]), this.parseFloatStr(tokens[2]), this.parseFloatStr(tokens[3])); +this.isAngstroms = J.jvxl.readers.VolumeFileReader.checkAtomLine(this.isXLowToHigh, this.isAngstroms, null, atomLine, this.jvxlFileHeaderBuffer); +if (!this.isAngstroms) this.volumetricOrigin.scale(0.5291772); +this.readVoxelVector(0); +this.readVoxelVector(1); +this.readVoxelVector(2); +for (var i = 0; i < this.ac; ++i) this.jvxlFileHeaderBuffer.append(this.rd() + "\n"); + +this.skipComments(true); +JU.Logger.info("Reading extra JVXL information line: " + this.line); +this.nSurfaces = this.parseIntStr(this.line); +if (!(this.isJvxl = (this.nSurfaces < 0))) return; +this.nSurfaces = -this.nSurfaces; +JU.Logger.info("jvxl file surfaces: " + this.nSurfaces); +var ich; +if ((ich = this.parseInt()) == -2147483648) { +JU.Logger.info("using default edge fraction base and range"); +} else { +this.edgeFractionBase = ich; +this.edgeFractionRange = this.parseInt(); +}if ((ich = this.parseInt()) == -2147483648) { +JU.Logger.info("using default color fraction base and range"); +} else { +this.colorFractionBase = ich; +this.colorFractionRange = this.parseInt(); +}this.cJvxlEdgeNaN = String.fromCharCode(this.edgeFractionBase + this.edgeFractionRange); +this.vertexDataOnly = this.jvxlData.vertexDataOnly = (this.volumetricVectors[0].length() == 0); +}); +Clazz.overrideMethod(c$, "jvxlReadFractionData", +function(type, nPoints){ +var str = ""; +try { +while (str.length < nPoints) { +this.rd(); +str += J.jvxl.data.JvxlCoder.jvxlDecompressString(this.line); +} +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.error("Error reading " + type + " data " + e); +throw new NullPointerException(); +} else { +throw e; +} +} +return str; +}, "~S,~N"); +Clazz.overrideMethod(c$, "gotoData", +function(n, nPoints){ +if (n > 0) JU.Logger.info("skipping " + n + " data sets, " + nPoints + " points each"); +this.vertexDataOnly = this.jvxlData.vertexDataOnly = (nPoints == 0); +for (var i = 0; i < n; i++) { +this.jvxlReadDefinitionLine(true); +JU.Logger.info("JVXL skipping: jvxlSurfaceDataCount=" + this.surfaceDataCount + " jvxlEdgeDataCount=" + this.edgeDataCount + " jvxlDataIsColorMapped=" + this.jvxlDataIsColorMapped); +this.jvxlSkipData(nPoints, true); +} +this.jvxlReadDefinitionLine(true); +}, "~N,~N"); +Clazz.defineMethod(c$, "jvxlReadDefinitionLine", +function(showMsg){ +var comment = this.skipComments(true); +if (showMsg) JU.Logger.info("reading jvxl data set: " + comment + this.line); +this.haveContourData = (comment.indexOf("+contourlines") >= 0); +this.jvxlCutoff = this.parseFloatStr(this.line); +JU.Logger.info("JVXL read: cutoff " + this.jvxlCutoff); +this.jvxlCutoffRange = this.parseFloatArray( Clazz.newFloatArray (2, 0), "[", "]"); +var param1 = this.parseInt(); +var param2 = this.parseInt(); +var param3 = this.parseInt(); +if (param3 == -2147483648 || param3 == -1) param3 = 0; +if (param1 == -1) { +try { +this.params.thePlane = JU.P4.new4(this.parseFloat(), this.parseFloat(), this.parseFloat(), this.parseFloat()); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.error("Error reading 4 floats for PLANE definition -- setting to 0 0 1 0 (z=0)"); +this.params.thePlane = JU.P4.new4(0, 0, 1, 0); +} else { +throw e; +} +} +JU.Logger.info("JVXL read: plane " + this.params.thePlane); +if (param2 == -1 && param3 < 0) param3 = -param3; +} else { +this.params.thePlane = null; +}if (param1 < 0 && param2 != -1) { +this.params.isContoured = (param3 != 0); +var nContoursRead = this.parseInt(); +if (nContoursRead == -2147483648) { +if (this.line.charAt(this.next[0]) == '[') { +this.jvxlData.contourValues = this.params.contoursDiscrete = this.parseFloatArray(null, null, null); +JU.Logger.info("JVXL read: contourValues " + JU.Escape.eAF(this.jvxlData.contourValues)); +this.jvxlData.contourColixes = this.params.contourColixes = JU.C.getColixArray(this.getQuotedStringNext()); +this.jvxlData.contourColors = JU.C.getHexCodes(this.jvxlData.contourColixes); +JU.Logger.info("JVXL read: contourColixes " + this.jvxlData.contourColors); +this.params.nContours = this.jvxlData.contourValues.length; +}} else { +if (nContoursRead < 0) { +nContoursRead = -1 - nContoursRead; +this.params.contourFromZero = false; +}if (nContoursRead != 0 && this.params.nContours == 0) { +this.params.nContours = nContoursRead; +JU.Logger.info("JVXL read: contours " + this.params.nContours); +}}} else { +this.params.isContoured = false; +}this.jvxlData.isJvxlPrecisionColor = (param1 == -1 && param2 == -2 || param3 < 0); +this.params.isBicolorMap = (param1 > 0 && param2 < 0); +this.jvxlDataIsColorMapped = (param3 != 0); +if (this.jvxlDataIsColorMapped) this.jvxlData.colorScheme = "RGB"; +this.jvxlDataIs2dContour = (this.jvxlDataIsColorMapped && this.params.isContoured); +if (this.params.isBicolorMap || this.params.colorBySign) this.jvxlCutoff = 0; +this.surfaceDataCount = (param1 < -1 ? -1 - param1 : param1 > 0 ? param1 : 0); +if (param1 == -1) this.edgeDataCount = 0; + else this.edgeDataCount = (param2 < -1 ? -param2 : param2 > 0 ? param2 : 0); +this.colorDataCount = (this.params.isBicolorMap ? -param2 : param3 < -1 ? -param3 : param3 > 0 ? param3 : 0); +if (this.params.colorBySign) this.params.isBicolorMap = true; +var dataMin = NaN; +var dataMax = NaN; +var red = NaN; +var blue = NaN; +var insideOut = (this.line.indexOf("insideOut") >= 0); +if (this.jvxlDataIsColorMapped) { +dataMin = this.parseFloat(); +dataMax = this.parseFloat(); +red = this.parseFloat(); +blue = this.parseFloat(); +}this.jvxlSetColorRanges(dataMin, dataMax, red, blue, insideOut); +}, "~B"); +Clazz.overrideMethod(c$, "readSurfaceData", +function(isMapDataIgnored){ +this.thisInside = !this.params.isContoured; +if (!this.readSurfaceDataXML()) this.readSurfaceDataJXR(); +}, "~B"); +Clazz.overrideMethod(c$, "jvxlSkipData", +function(nPoints, doSkipColorData){ +if (this.surfaceDataCount > 0) this.jvxlSkipDataBlock(nPoints, true); +if (this.edgeDataCount > 0) this.jvxlSkipDataBlock(this.edgeDataCount, false); +if (this.jvxlDataIsColorMapped && doSkipColorData) this.jvxlSkipDataBlock(this.colorDataCount, false); +}, "~N,~B"); +Clazz.defineMethod(c$, "jvxlSkipDataBlock", +function(nPoints, isInt){ +var n = 0; +while (n < nPoints) { +this.rd(); +n += (isInt ? this.countData(this.line) : J.jvxl.data.JvxlCoder.jvxlDecompressString(this.line).length); +} +}, "~N,~B"); +Clazz.defineMethod(c$, "countData", +function(str){ +var $private = Clazz.checkPrivateMethod (arguments); +if ($private != null) { +return $private.apply (this, arguments); +} +var count = 0; +var n = this.parseIntStr(str); +while (n != -2147483648) { +count += n; +n = this.parseIntNext(str); +} +return count; +}, "~S"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/JvxlXmlReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/JvxlXmlReader.js new file mode 100755 index 000000000000..fa35f9ebf95f --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/JvxlXmlReader.js @@ -0,0 +1,700 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.VolumeFileReader"], "J.jvxl.readers.JvxlXmlReader", ["java.util.Hashtable", "JU.AU", "$.BS", "$.CU", "$.Lst", "$.P3", "$.P4", "$.PT", "$.SB", "J.jvxl.data.JvxlCoder", "$.MeshData", "J.jvxl.readers.XmlReader", "J.shapesurface.IsosurfaceMesh", "JU.C", "$.ColorEncoder", "$.Escape", "$.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.JVXL_VERSION = "2.3"; +this.surfaceDataCount = 0; +this.edgeDataCount = 0; +this.colorDataCount = 0; +this.excludedTriangleCount = 0; +this.excludedVertexCount = 0; +this.invalidatedVertexCount = 0; +this.haveContourData = false; +this.xr = null; +this.isXmlFile = true; +this.thisInside = false; +this.tempDataXml = null; +this.bsVoxelBitSet = null; +this.includeValueNaN = true; +this.valueCount = 0; +this.valueMin = NaN; +this.valueRange = NaN; +this.fractionPtr = 0; +this.colorPtr = 0; +this.strFractionTemp = ""; +this.haveReadColorData = false; +this.jvxlColorEncodingRead = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "JvxlXmlReader", J.jvxl.readers.VolumeFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.JvxlXmlReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2JXR(sg, br); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.defineMethod(c$, "init2JXR", +function(sg, br){ +this.init2VFR(sg, br); +this.jvxlData.wasJvxl = this.isJvxl = true; +this.isXLowToHigh = this.canDownsample = false; +this.xr = new J.jvxl.readers.XmlReader(br); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readVolumeData", +function(isMapData){ +if (!this.readVolumeDataVFR(isMapData)) return false; +this.strFractionTemp = this.jvxlEdgeDataRead; +this.fractionPtr = 0; +return true; +}, "~B"); +Clazz.overrideMethod(c$, "gotoAndReadVoxelData", +function(isMapData){ +this.initializeVolumetricData(); +if (this.nPointsX < 0 || this.nPointsY < 0 || this.nPointsZ < 0) return true; +try { +this.gotoData(this.params.fileIndex - 1, this.nPointsX * this.nPointsY * this.nPointsZ); +if (this.vertexDataOnly) return true; +this.volumeData.setMappingPlane(this.params.thePlane); +this.readSurfaceData(isMapData); +this.volumeData.setMappingPlane(null); +if (this.edgeDataCount > 0) this.jvxlEdgeDataRead = this.jvxlReadFractionData("edge", this.edgeDataCount); +this.params.bsExcluded = this.jvxlData.jvxlExcluded = new Array(4); +this.hasColorData = (this.colorDataCount > 0); +if (this.hasColorData) this.jvxlColorDataRead = this.jvxlReadFractionData("color", this.colorDataCount); +if (this.excludedVertexCount > 0) { +this.jvxlData.jvxlExcluded[0] = J.jvxl.data.JvxlCoder.jvxlDecodeBitSet(this.xr.getXmlData("jvxlExcludedVertexData", null, false, false)); +if (this.xr.isNext("jvxlExcludedPlaneData")) this.jvxlData.jvxlExcluded[2] = J.jvxl.data.JvxlCoder.jvxlDecodeBitSet(this.xr.getXmlData("jvxlExcludedPlaneData", null, false, false)); +}if (this.excludedTriangleCount > 0) this.jvxlData.jvxlExcluded[3] = J.jvxl.data.JvxlCoder.jvxlDecodeBitSet(this.xr.getXmlData("jvxlExcludedTriangleData", null, false, false)); +if (this.invalidatedVertexCount > 0) this.jvxlData.jvxlExcluded[1] = J.jvxl.data.JvxlCoder.jvxlDecodeBitSet(this.xr.getXmlData("jvxlInvalidatedVertexData", null, false, false)); +if (this.haveContourData) this.jvxlDecodeContourData(this.jvxlData, this.xr.getXmlData("jvxlContourData", null, false, false)); +if (this.jvxlDataIsColorMapped && this.jvxlData.nVertexColors > 0) { +this.jvxlData.vertexColorMap = new java.util.Hashtable(); +var vdata = this.xr.getXmlData("jvxlVertexColorData", null, true, false); +var baseColor = J.jvxl.readers.XmlReader.getXmlAttrib(vdata, "baseColor"); +this.jvxlData.baseColor = (baseColor.length > 0 ? baseColor : null); +for (var i = 0; i < this.jvxlData.nVertexColors; i++) { +var s = this.xr.getXmlData("jvxlColorMap", vdata, true, false); +var color = J.jvxl.readers.XmlReader.getXmlAttrib(s, "color"); +var bs = J.jvxl.data.JvxlCoder.jvxlDecodeBitSet(this.xr.getXmlData("jvxlColorMap", s, false, false)); +this.jvxlData.vertexColorMap.put(color, bs); +} +}} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.error(e.toString()); +return false; +} else { +throw e; +} +} +return true; +}, "~B"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +var s = this.xr.getXmlDataLF("jvxlFileTitle", null, false, false, true); +this.jvxlFileHeaderBuffer = JU.SB.newS(s == null ? "" : s); +this.xr.toTag("jvxlVolumeData"); +var data = this.tempDataXml = this.xr.getXmlData("jvxlVolumeData", null, true, false); +this.volumetricOrigin.setT(this.xr.getXmlPoint(data, "origin")); +this.isAngstroms = true; +this.readVector(0); +this.readVector(1); +this.readVector(2); +this.line = this.xr.toTag("jvxlSurfaceSet"); +this.nSurfaces = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(this.line, "count")); +JU.Logger.info("jvxl file surfaces: " + this.nSurfaces); +JU.Logger.info("using default edge fraction base and range"); +JU.Logger.info("using default color fraction base and range"); +this.cJvxlEdgeNaN = String.fromCharCode(this.edgeFractionBase + this.edgeFractionRange); +}); +Clazz.overrideMethod(c$, "getJVXLCutoff", +function(){ +return this.params.cutoff; +}); +Clazz.defineMethod(c$, "readVector", +function(voxelVectorIndex){ +var data = this.xr.getXmlData("jvxlVolumeVector", this.tempDataXml, true, true); +this.tempDataXml = this.tempDataXml.substring(this.tempDataXml.indexOf(data) + data.length); +var n = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "count")); +if (n == -2147483648) this.vertexDataOnly = true; +this.voxelCounts[voxelVectorIndex] = (n < 0 ? 0 : n); +this.volumetricVectors[voxelVectorIndex].setT(this.xr.getXmlPoint(data, "vector")); +if (this.isAnisotropic) this.setVectorAnisotropy(this.volumetricVectors[voxelVectorIndex]); +}, "~N"); +Clazz.overrideMethod(c$, "gotoData", +function(n, nPoints){ +if (n > 0) JU.Logger.info("skipping " + n + " data sets, " + nPoints + " points each"); +this.vertexDataOnly = this.jvxlData.vertexDataOnly = (nPoints == 0); +for (var i = 0; i < n; i++) { +this.jvxlSkipData(nPoints, true); +} +this.xr.toTag("jvxlSurface"); +this.jvxlReadSurfaceInfo(); +}, "~N,~N"); +Clazz.defineMethod(c$, "jvxlSkipData", +function(nPoints, doSkipColorData){ +this.rd(); +this.xr.skipTag("jvxlSurface"); +}, "~N,~B"); +Clazz.defineMethod(c$, "jvxlReadSurfaceInfo", +function(){ +var data = this.xr.getXmlData("jvxlSurfaceInfo", null, true, true); +this.isXLowToHigh = J.jvxl.readers.XmlReader.getXmlAttrib(data, "isXLowToHigh").equals("true"); +var s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "cutoff"); +if (s.indexOf(" ") < 0) { +this.jvxlCutoff = this.parseFloatStr(s); +if (!Double.isNaN(this.jvxlCutoff)) JU.Logger.info("JVXL read: cutoff " + this.jvxlCutoff); +} else { +this.jvxlCutoffRange = this.parseFloatArrayStr(s); +this.jvxlCutoff = this.jvxlCutoffRange[0]; +JU.Logger.info("JVXL read: cutoff " + JU.Escape.eAF(this.jvxlCutoffRange)); +}this.params.cutoff = this.jvxlCutoff; +var nContourData = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "nContourData")); +this.haveContourData = (nContourData > 0); +this.params.isContoured = this.jvxlData.isModelConnected = J.jvxl.readers.XmlReader.getXmlAttrib(data, "contoured").equals("true"); +this.params.isModelConnected = J.jvxl.readers.XmlReader.getXmlAttrib(data, "isModelConnected").equals("true"); +if (this.params.isContoured) { +var nContoursRead = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "nContours")); +if (nContoursRead <= 0) { +nContoursRead = 0; +} else { +if (this.params.thisContour < 0) this.params.thisContour = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "thisContour")); +s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "contourValues"); +if (s.length > 0) { +s = s.$replace('[', ' ').$replace(']', ' '); +this.jvxlData.contourValues = this.params.contoursDiscrete = this.parseFloatArrayStr(s); +JU.Logger.info("JVXL read: contourValues " + JU.Escape.eAF(this.jvxlData.contourValues)); +}s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "contourColors"); +if (s.length > 0) { +this.jvxlData.contourColixes = this.params.contourColixes = JU.C.getColixArray(s); +this.jvxlData.contourColors = JU.C.getHexCodes(this.jvxlData.contourColixes); +JU.Logger.info("JVXL read: contourColixes " + JU.C.getHexCodes(this.jvxlData.contourColixes)); +}this.params.contourFromZero = J.jvxl.readers.XmlReader.getXmlAttrib(data, "contourFromZero").equals("true"); +}this.params.nContours = (this.haveContourData ? nContourData : nContoursRead); +}this.jvxlData.nVertexColors = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "nVertexColors")); +this.params.isBicolorMap = J.jvxl.readers.XmlReader.getXmlAttrib(data, "bicolorMap").equals("true"); +if (this.params.isBicolorMap) { +s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "colorPositive"); +if (s.length > 0 && this.params.colorRgb == -2147483648 && this.params.colorPos == -16776961) this.params.colorPos = JU.CU.getArgbFromString(s); +s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "colorNegative"); +if (s.length > 0 && this.params.colorRgb == -2147483648 && this.params.colorNeg == -65536) this.params.colorNeg = JU.CU.getArgbFromString(s); +}if (this.params.isBicolorMap || this.params.colorBySign) this.jvxlCutoff = 0; +this.jvxlDataIsColorMapped = ((this.params.colorRgb == -2147483648 || this.params.colorRgb == 2147483647) && (this.params.isBicolorMap || J.jvxl.readers.XmlReader.getXmlAttrib(data, "colorMapped").equals("true"))); +this.jvxlData.isJvxlPrecisionColor = J.jvxl.readers.XmlReader.getXmlAttrib(data, "precisionColor").equals("true"); +this.jvxlData.jvxlDataIsColorDensity = this.params.colorDensity = (this.params.colorRgb == -2147483648 && J.jvxl.readers.XmlReader.getXmlAttrib(data, "colorDensity").equals("true")); +if (this.jvxlData.jvxlDataIsColorDensity && Float.isNaN(this.params.pointSize)) { +s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "pointSize"); +if (s.length > 0) this.jvxlData.pointSize = this.params.pointSize = this.parseFloatStr(s); +}s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "allowVolumeRender"); +this.jvxlData.allowVolumeRender = this.params.allowVolumeRender = (s.length == 0 || s.equalsIgnoreCase("true")); +s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "plane"); +if (s.indexOf("{") >= 0) { +this.params.thePlane = null; +this.params.mapLattice = null; +try { +this.params.thePlane = JU.Escape.uP(s); +s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "maplattice"); +JU.Logger.info("JVXL read: plane " + this.params.thePlane); +if (s.indexOf("{") >= 0) { +this.params.mapLattice = JU.Escape.uP(s); +JU.Logger.info("JVXL read: mapLattice " + this.params.mapLattice); +}if (this.params.scale3d == 0) this.params.scale3d = this.parseFloatStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "scale3d")); +if (Float.isNaN(this.params.scale3d)) this.params.scale3d = 0; +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +if (this.params.thePlane == null) { +JU.Logger.error("JVXL Error reading plane definition -- setting to 0 0 1 0 (z=0)"); +this.params.thePlane = JU.P4.new4(0, 0, 1, 0); +} else { +JU.Logger.error("JVXL Error reading mapLattice definition -- ignored"); +}} else { +throw e; +} +} +this.surfaceDataCount = 0; +this.edgeDataCount = 0; +} else { +this.params.thePlane = null; +this.surfaceDataCount = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "nSurfaceInts")); +this.edgeDataCount = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "nBytesUncompressedEdgeData")); +s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "fixedLattice"); +if (s.indexOf("{") >= 0) this.jvxlData.fixedLattice = JU.Escape.uP(s); +}this.excludedVertexCount = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "nExcludedVertexes")); +this.excludedTriangleCount = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "nExcludedTriangles")); +this.invalidatedVertexCount = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "nInvalidatedVertexes")); +s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "slabInfo"); +if (s.length > 0) this.jvxlData.slabInfo = s; +this.colorDataCount = Math.max(0, this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "nBytesUncompressedColorData"))); +this.jvxlDataIs2dContour = (this.params.thePlane != null && this.jvxlDataIsColorMapped); +this.jvxlData.color = J.jvxl.readers.XmlReader.getXmlAttrib(data, "color"); +if (this.jvxlData.color.length == 0 || this.jvxlData.color.indexOf("null") >= 0) this.jvxlData.color = "orange"; +this.jvxlData.translucency = this.parseFloatStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "translucency")); +if (Float.isNaN(this.jvxlData.translucency)) this.jvxlData.translucency = 0; +s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "meshColor"); +if (s.length > 0) this.jvxlData.meshColor = s; +s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "rendering"); +if (s.length > 0) this.jvxlData.rendering = s; +this.jvxlData.colorScheme = J.jvxl.readers.XmlReader.getXmlAttrib(data, "colorScheme"); +if (this.jvxlData.colorScheme.length == 0) this.jvxlData.colorScheme = (this.jvxlDataIsColorMapped ? "roygb" : null); +if (this.jvxlData.thisSet == null) { +var n = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "set")); +if (n > 0) { +this.jvxlData.thisSet = new JU.BS(); +this.jvxlData.thisSet.set(n - 1); +}var a = J.jvxl.readers.XmlReader.getXmlAttrib(data, "subset"); +if (a != null && a.length > 2) { +var sets = a.$replace('[', ' ').$replace(']', ' ').trim().$plit(" "); +if (sets.length > 0) { +this.jvxlData.thisSet = new JU.BS(); +for (var i = sets.length; --i >= 0; ) { +this.jvxlData.thisSet.set(JU.PT.parseInt(sets[i]) - 1); +} +}}}this.jvxlData.slabValue = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "slabValue")); +this.jvxlData.isSlabbable = (J.jvxl.readers.XmlReader.getXmlAttrib(data, "slabbable").equalsIgnoreCase("true")); +this.jvxlData.diameter = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "diameter")); +if (this.jvxlData.diameter == -2147483648) this.jvxlData.diameter = 0; +if (this.jvxlDataIs2dContour) this.params.isContoured = true; +if (this.params.colorBySign) this.params.isBicolorMap = true; +var insideOut = J.jvxl.readers.XmlReader.getXmlAttrib(data, "insideOut").equals("true"); +var dataMin = NaN; +var dataMax = NaN; +var red = NaN; +var blue = NaN; +if (this.jvxlDataIsColorMapped) { +dataMin = this.parseFloatStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "dataMinimum")); +dataMax = this.parseFloatStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "dataMaximum")); +red = this.parseFloatStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "valueMappedToRed")); +blue = this.parseFloatStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "valueMappedToBlue")); +if (Float.isNaN(dataMin)) { +dataMin = red = -1.0; +dataMax = blue = 1; +}}this.jvxlSetColorRanges(dataMin, dataMax, red, blue, insideOut); +}); +Clazz.defineMethod(c$, "jvxlSetColorRanges", +function(dataMin, dataMax, red, blue, insideOut){ +if (this.jvxlDataIsColorMapped) { +if (!Float.isNaN(dataMin) && !Float.isNaN(dataMax)) { +if (dataMax == 0 && dataMin == 0) { +dataMin = -1; +dataMax = 1; +}this.params.mappedDataMin = dataMin; +this.params.mappedDataMax = dataMax; +JU.Logger.info("JVXL read: data_min/max " + this.params.mappedDataMin + "/" + this.params.mappedDataMax); +}if (!this.params.rangeDefined) if (!Float.isNaN(red) && !Float.isNaN(blue)) { +if (red == 0 && blue == 0) { +red = -1; +blue = 1; +}this.params.valueMappedToRed = Math.min(red, blue); +this.params.valueMappedToBlue = Math.max(red, blue); +this.params.isColorReversed = (red > blue); +this.params.rangeDefined = true; +} else { +this.params.valueMappedToRed = 0; +this.params.valueMappedToBlue = 1; +this.params.rangeDefined = true; +}JU.Logger.info("JVXL read: color red/blue: " + this.params.valueMappedToRed + "/" + this.params.valueMappedToBlue); +}this.jvxlData.valueMappedToRed = this.params.valueMappedToRed; +this.jvxlData.valueMappedToBlue = this.params.valueMappedToBlue; +this.jvxlData.mappedDataMin = this.params.mappedDataMin; +this.jvxlData.mappedDataMax = this.params.mappedDataMax; +this.jvxlData.isColorReversed = this.params.isColorReversed; +if (this.params.insideOut) insideOut = !insideOut; +this.params.insideOut = this.jvxlData.insideOut = insideOut; +}, "~N,~N,~N,~N,~B"); +Clazz.overrideMethod(c$, "readSurfaceData", +function(isMapDataIgnored){ +this.thisInside = !this.params.isContoured; +if (this.readSurfaceDataXML()) return; +this.tempDataXml = this.xr.getXmlData("jvxlEdgeData", null, true, false); +this.bsVoxelBitSet = J.jvxl.data.JvxlCoder.jvxlDecodeBitSet(this.xr.getXmlData("jvxlEdgeData", this.tempDataXml, false, false)); +this.readSurfaceDataJXR(); +}, "~B"); +Clazz.defineMethod(c$, "readSurfaceDataXML", +function(){ +if (this.vertexDataOnly) { +this.getEncodedVertexData(); +return true; +}if (this.params.thePlane != null) { +this.volumeData.setDataDistanceToPlane(this.params.thePlane); +this.setVolumeDataV(this.volumeData); +this.params.cutoff = 0; +this.jvxlData.setSurfaceInfo(this.params.thePlane, this.params.mapLattice, 0, ""); +this.jvxlData.scale3d = this.params.scale3d; +return true; +}return false; +}); +Clazz.defineMethod(c$, "readSurfaceDataJXR", +function(){ +this.readSurfaceDataVFR(false); +this.volumeData.setMappingPlane(null); +}); +Clazz.defineMethod(c$, "jvxlReadFractionData", +function(type, nPoints){ +var str; +try { +if (type.equals("edge")) { +str = J.jvxl.data.JvxlCoder.jvxlDecompressString(J.jvxl.readers.XmlReader.getXmlAttrib(this.tempDataXml, "data")); +} else { +var data = this.xr.getXmlData("jvxlColorData", null, true, false); +this.jvxlData.isJvxlPrecisionColor = J.jvxl.readers.JvxlXmlReader.getEncoding(data).endsWith("2"); +str = J.jvxl.data.JvxlCoder.jvxlDecompressString(J.jvxl.readers.XmlReader.getXmlAttrib(data, "data")); +}} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.error("Error reading " + type + " data " + e); +throw new NullPointerException(); +} else { +throw e; +} +} +return str; +}, "~S,~N"); +Clazz.overrideMethod(c$, "getVoxelBitSet", +function(nPoints){ +if (this.bsVoxelBitSet != null) return this.bsVoxelBitSet; +var bs = new JU.BS(); +var bsVoxelPtr = 0; +if (this.surfaceDataCount <= 0) return bs; +var nThisValue = 0; +while (bsVoxelPtr < nPoints) { +nThisValue = this.parseInt(); +if (nThisValue == -2147483648) { +this.rd(); +if (this.line == null || (nThisValue = this.parseIntStr(this.line)) == -2147483648) { +if (!this.endOfData) JU.Logger.error("end of file in JvxlReader?" + " line=" + this.line); +this.endOfData = true; +nThisValue = 10000; +}}this.thisInside = !this.thisInside; +++this.jvxlNSurfaceInts; +if (this.thisInside) bs.setBits(bsVoxelPtr, bsVoxelPtr + nThisValue); +bsVoxelPtr += nThisValue; +} +return bs; +}, "~N"); +Clazz.overrideMethod(c$, "getSurfacePointAndFraction", +function(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, ptReturn){ +if (this.edgeDataCount <= 0) return this.getSPFv(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, ptReturn); +ptReturn.scaleAdd2(fReturn[0] = this.jvxlGetNextFraction(this.edgeFractionBase, this.edgeFractionRange, 0.5), edgeVector, pointA); +if (Float.isNaN(this.valueMin)) this.setValueMinMax(); +return (this.valueCount == 0 || this.includeValueNaN && Float.isNaN(fReturn[0]) ? fReturn[0] : this.getNextValue()); +}, "~N,~B,~N,~N,JU.T3,JU.V3,~N,~N,~N,~N,~N,~A,JU.T3"); +Clazz.defineMethod(c$, "getNextValue", +function(){ +var fraction = NaN; +while (this.colorPtr < this.valueCount && Float.isNaN(fraction)) { +if (this.jvxlData.isJvxlPrecisionColor) { +fraction = J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter2(this.jvxlColorDataRead.charAt(this.colorPtr).charCodeAt(0), this.jvxlColorDataRead.charAt((this.colorPtr++) + this.valueCount).charCodeAt(0), this.colorFractionBase, this.colorFractionRange); +} else { +fraction = J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter(this.jvxlColorDataRead.charAt(this.colorPtr++).charCodeAt(0), this.colorFractionBase, this.colorFractionRange, 0.5); +}break; +} +return this.valueMin + fraction * this.valueRange; +}); +Clazz.defineMethod(c$, "setValueMinMax", +function(){ +this.valueCount = this.jvxlColorDataRead.length; +if (this.jvxlData.isJvxlPrecisionColor) this.valueCount /= 2; +this.includeValueNaN = (this.valueCount != this.jvxlEdgeDataRead.length); +this.valueMin = (!this.jvxlData.isJvxlPrecisionColor ? this.params.valueMappedToRed : this.params.mappedDataMin == 3.4028235E38 ? 0.0 : this.params.mappedDataMin); +this.valueRange = (!this.jvxlData.isJvxlPrecisionColor ? this.params.valueMappedToBlue : this.params.mappedDataMin == 3.4028235E38 ? 1.0 : this.params.mappedDataMax) - this.valueMin; +this.haveReadColorData = true; +}); +Clazz.defineMethod(c$, "jvxlGetNextFraction", +function(base, range, fracOffset){ +if (this.fractionPtr >= this.strFractionTemp.length) { +if (!this.endOfData) JU.Logger.error("end of file reading compressed fraction data"); +this.endOfData = true; +this.strFractionTemp = "" + String.fromCharCode(base); +this.fractionPtr = 0; +}return J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter(this.strFractionTemp.charAt(this.fractionPtr++).charCodeAt(0), base, range, fracOffset); +}, "~N,~N,~N"); +Clazz.overrideMethod(c$, "readColorData", +function(){ +if (!this.jvxlDataIsColorMapped) return ""; +var vertexCount = this.jvxlData.vertexCount = this.meshData.vc; +var colixes = this.meshData.vcs; +var vertexValues = this.meshData.vvs; +if ("none".equals(this.jvxlColorEncodingRead)) { +this.jvxlData.vertexColors = Clazz.newIntArray (vertexCount, 0); +var nextc = Clazz.newIntArray (1, 0); +var n = JU.PT.parseIntNext(this.jvxlColorDataRead, nextc); +n = Math.min(n, vertexCount); +var tokens = JU.PT.getTokens(this.jvxlColorDataRead.substring(nextc[0])); +var haveTranslucent = false; +var trans = this.jvxlData.translucency; +var lastColor = 0; +for (var i = 0; i < n; i++) try { +var c = J.jvxl.readers.JvxlXmlReader.getColor(tokens[i]); +if (c == 0) c = lastColor; + else lastColor = c; +colixes[i] = JU.C.getColixTranslucent(this.jvxlData.vertexColors[i] = c); +if (JU.C.isColixTranslucent(colixes[i])) haveTranslucent = true; + else if (trans != 0) colixes[i] = JU.C.getColixTranslucent3(colixes[i], true, trans); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.info("JvxlXmlReader: Cannot interpret color code: " + tokens[i]); +} else { +throw e; +} +} + +if (haveTranslucent && trans == 0) { +this.jvxlData.translucency = 0.5; +}return "-"; +}if (this.params.colorEncoder == null) this.params.colorEncoder = new JU.ColorEncoder(null, null); +this.params.colorEncoder.setColorScheme(null, false); +this.params.colorEncoder.setRange(this.params.valueMappedToRed, this.params.valueMappedToBlue, this.params.isColorReversed); +JU.Logger.info("JVXL reading color data mapped min/max: " + this.params.mappedDataMin + "/" + this.params.mappedDataMax + " for " + vertexCount + " vertices." + " using encoding keys " + this.colorFractionBase + " " + this.colorFractionRange); +JU.Logger.info("mapping red-->blue for " + this.params.valueMappedToRed + " to " + this.params.valueMappedToBlue + " colorPrecision:" + this.jvxlData.isJvxlPrecisionColor); +var getValues = (Float.isNaN(this.valueMin)); +if (getValues) this.setValueMinMax(); +var contourPlaneMinimumValue = 3.4028235E38; +var contourPlaneMaximumValue = -3.4028235E38; +if (colixes == null || colixes.length < vertexCount) this.meshData.vcs = colixes = Clazz.newShortArray (vertexCount, 0); +var colixNeg = 0; +var colixPos = 0; +if (this.params.colorBySign) { +colixPos = JU.C.getColix(this.params.isColorReversed ? this.params.colorNeg : this.params.colorPos); +colixNeg = JU.C.getColix(this.params.isColorReversed ? this.params.colorPos : this.params.colorNeg); +}var vertexIncrement = this.meshData.vertexIncrement; +var needContourMinMax = (this.params.mappedDataMin == 3.4028235E38); +for (var i = 0; i < vertexCount; i += vertexIncrement) { +var value; +if (getValues) value = vertexValues[i] = this.getNextValue(); + else value = vertexValues[i]; +if (needContourMinMax) { +if (value < contourPlaneMinimumValue) contourPlaneMinimumValue = value; +if (value > contourPlaneMaximumValue) contourPlaneMaximumValue = value; +}} +if (needContourMinMax) { +this.params.mappedDataMin = contourPlaneMinimumValue; +this.params.mappedDataMax = contourPlaneMaximumValue; +}if (this.jvxlData.colorScheme != null) { +var setContourValue = (this.marchingSquares != null && this.params.isContoured); +for (var i = 0; i < vertexCount; i += vertexIncrement) { +var value = vertexValues[i]; +if (setContourValue) { +this.marchingSquares.setContourData(i, value); +continue; +}var colix = (!this.params.colorBySign ? this.params.colorEncoder.getColorIndex(value) : (this.params.isColorReversed ? value > 0 : value <= 0) ? colixNeg : colixPos); +colixes[i] = JU.C.getColixTranslucent3(colix, true, this.jvxlData.translucency); +} +}return this.jvxlColorDataRead + "\n"; +}); +c$.getColor = Clazz.defineMethod(c$, "getColor", +function(c){ +var n = 0; +try { +switch ((c.charAt(0)).charCodeAt(0)) { +case 91: +n = JU.CU.getArgbFromString(c); +break; +case 48: +n = JU.PT.parseIntRadix(c.substring(2), 16); +break; +default: +n = JU.PT.parseIntRadix(c, 10); +} +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +return n; +}, "~S"); +Clazz.defineMethod(c$, "getEncodedVertexData", +function(){ +var sdata = this.xr.getXmlData("jvxlSurfaceData", null, true, false); +this.jvxlDecodeVertexData(this.xr.getXmlData("jvxlVertexData", sdata, true, false), false); +var tData = this.xr.getXmlData("jvxlTriangleData", sdata, true, false); +var edgeData = this.xr.getXmlData("jvxlTriangleEdgeData", sdata, true, false); +var polygonColorData = this.xr.getXmlData("jvxlPolygonColorData", sdata, false, false); +this.jvxlDecodeTriangleData(tData, edgeData, polygonColorData); +var cData = this.xr.getXmlData("jvxlColorData", sdata, true, false); +this.jvxlColorEncodingRead = J.jvxl.readers.JvxlXmlReader.getEncoding(cData); +this.jvxlData.isJvxlPrecisionColor = this.jvxlColorEncodingRead.endsWith("2"); +cData = this.getData(cData, "jvxlColorData"); +this.jvxlColorDataRead = (this.jvxlColorEncodingRead.equals("none") ? cData : J.jvxl.data.JvxlCoder.jvxlDecompressString(cData)); +this.jvxlDataIsColorMapped = ((this.params.colorRgb == -2147483648 || this.params.colorRgb == 2147483647) && this.jvxlColorDataRead.length > 0); +if (this.haveContourData) this.jvxlDecodeContourData(this.jvxlData, this.xr.getXmlData("jvxlContourData", null, false, false)); +}); +Clazz.defineMethod(c$, "getData", +function(sdata, name){ +var data = J.jvxl.readers.XmlReader.getXmlAttrib(sdata, "data"); +if (data.length == 0) data = this.xr.getXmlData(name, sdata, false, false); +return data; +}, "~S,~S"); +c$.getEncoding = Clazz.defineMethod(c$, "getEncoding", +function(data){ +if (J.jvxl.readers.XmlReader.getXmlAttrib(data, "len").length > 0) return ""; +var s = J.jvxl.readers.XmlReader.getXmlAttrib(data, "encoding"); +return (s.length == 0 ? "none" : s); +}, "~S"); +Clazz.defineMethod(c$, "jvxlDecodeVertexData", +function(data, asArray){ +var vertexCount = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(data, "count")); +if (!asArray) JU.Logger.info("Reading " + vertexCount + " vertices"); +var ptCount = vertexCount * 3; +var vertices = (asArray ? new Array(vertexCount) : null); +var fraction; +var vData = J.jvxl.readers.XmlReader.getXmlAttrib(data, "data"); +var encoding = J.jvxl.readers.JvxlXmlReader.getEncoding(data); +if ("none".equals(encoding)) { +if (vData.length == 0) vData = this.xr.getXmlData("jvxlVertexData", data, false, false); +var fdata = JU.PT.parseFloatArray(vData); +if (fdata[0] != vertexCount * 3) JU.Logger.info("JvxlXmlReader: vertexData count=" + (Clazz.floatToInt(fdata[0])) + "; expected " + (vertexCount * 3)); +for (var i = 0, pt = 1; i < vertexCount; i++) { +var p = JU.P3.new3(fdata[pt++], fdata[pt++], fdata[pt++]); +if (asArray) vertices[i] = p; + else this.addVertexCopy(p, 0, i, false); +} +} else { +var min = this.xr.getXmlPoint(data, "min"); +var range = this.xr.getXmlPoint(data, "max"); +range.sub(min); +var colorFractionBase = this.jvxlData.colorFractionBase; +var colorFractionRange = this.jvxlData.colorFractionRange; +var s = J.jvxl.data.JvxlCoder.jvxlDecompressString(vData); +if (s.length == 0) s = this.xr.getXmlData("jvxlVertexData", data, false, false); +for (var i = 0, pt = -1; i < vertexCount; i++) { +var p = new JU.P3(); +fraction = J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter2(s.charAt(++pt).charCodeAt(0), s.charAt(pt + ptCount).charCodeAt(0), colorFractionBase, colorFractionRange); +p.x = min.x + fraction * range.x; +fraction = J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter2(s.charAt(++pt).charCodeAt(0), s.charAt(pt + ptCount).charCodeAt(0), colorFractionBase, colorFractionRange); +p.y = min.y + fraction * range.y; +fraction = J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter2(s.charAt(++pt).charCodeAt(0), s.charAt(pt + ptCount).charCodeAt(0), colorFractionBase, colorFractionRange); +p.z = min.z + fraction * range.z; +if (asArray) vertices[i] = p; + else this.addVertexCopy(p, 0, i, false); +} +}return vertices; +}, "~S,~B"); +Clazz.defineMethod(c$, "jvxlDecodeTriangleData", +function(tdata, edgeData, colorData){ +var nTriangles = this.parseIntStr(J.jvxl.readers.XmlReader.getXmlAttrib(tdata, "count")); +if (nTriangles < 0) return; +var nextc = Clazz.newIntArray (1, 0); +var nColors = (colorData == null ? -1 : 1); +var color = 0; +JU.Logger.info("Reading " + nTriangles + " triangles"); +var encoding = J.jvxl.readers.JvxlXmlReader.getEncoding(tdata); +tdata = this.getData(tdata, "jvxlTriangleData"); +var edata = this.getData(edgeData, "jvxlTriangleEdgeData"); +var vertex = Clazz.newIntArray (3, 0); +var nextp = Clazz.newIntArray (1, 0); +var nexte = null; +var edgeMask = 7; +var haveEdgeInfo; +var haveEncoding = !"none".equals(encoding); +if (haveEncoding) { +tdata = J.jvxl.data.JvxlCoder.jvxlDecompressString(tdata); +edata = J.jvxl.data.JvxlCoder.jvxlDecompressString(edata).trim(); +haveEdgeInfo = (edata.length == nTriangles); +} else { +var n = JU.PT.parseIntNext(tdata, nextp); +haveEdgeInfo = (edata.length > 0); +if (haveEdgeInfo) { +nexte = Clazz.newIntArray (1, 0); +JU.PT.parseIntNext(edata, nexte); +} else if (n > 0) { +JU.Logger.info("JvxlXmlReader: jvxlTriangleEdgeData count=" + n + "; expected " + nTriangles); +}}for (var i = 0, v = 0, p = 0, pt = -1; i < nTriangles; ) { +if (haveEncoding) { +var ch = tdata.charAt(++pt); +var diff; +switch ((ch).charCodeAt(0)) { +case 33: +diff = 0; +break; +case 43: +case 46: +case 32: +case 10: +case 13: +case 9: +case 44: +continue; +case 45: +case 48: +case 49: +case 50: +case 51: +case 52: +case 53: +case 54: +case 55: +case 56: +case 57: +nextp[0] = pt; +diff = JU.PT.parseIntNext(tdata, nextp); +pt = nextp[0] - 1; +break; +default: +diff = ch.charCodeAt(0) - 92; +} +v += diff; +} else { +v = JU.PT.parseIntNext(tdata, nextp) - 1; +}vertex[p] = v; +if (++p == 3) { +p = 0; +if (haveEdgeInfo) { +edgeMask = (nexte == null ? (edata.charAt(i)).charCodeAt(0) - 48 : JU.PT.parseIntNext(edata, nexte)); +if (edgeMask < 0 || edgeMask > 7) edgeMask = 7; +}if (--nColors == 0) { +nColors = (JU.PT.parseIntNext(colorData, nextc)); +var c = JU.PT.parseIntNext(colorData, nextc); +if (c == -2147483648) nColors = 0; + else color = c | 0xFF000000; +}this.addTriangleCheck(vertex[0], vertex[1], vertex[2], edgeMask, color, false, color); +i++; +}} +}, "~S,~S,~S"); +Clazz.defineMethod(c$, "jvxlDecodeContourData", +function(jvxlData, data){ +var vs = new JU.Lst(); +var values = new JU.SB(); +var colors = new JU.SB(); +var pt = -1; +jvxlData.vContours = null; +if (data == null) return; +while ((pt = data.indexOf(" = 0) { +var v = new JU.Lst(); +var s = this.xr.getXmlData("jvxlContour", data.substring(pt), true, false); +var value = this.parseFloatStr(J.jvxl.readers.XmlReader.getXmlAttrib(s, "value")); +values.append(" ").appendF(value); +var color = J.jvxl.readers.JvxlXmlReader.getColor(J.jvxl.readers.XmlReader.getXmlAttrib(s, "color")); +var colix = JU.C.getColix(color); +colors.append(" ").append(JU.Escape.escapeColor(color)); +var fData = J.jvxl.data.JvxlCoder.jvxlDecompressString(J.jvxl.readers.XmlReader.getXmlAttrib(s, "data")); +var bs = J.jvxl.data.JvxlCoder.jvxlDecodeBitSet(this.xr.getXmlData("jvxlContour", s, false, false)); +var n = bs.length(); +J.shapesurface.IsosurfaceMesh.setContourVector(v, n, bs, value, colix, color, JU.SB.newS(fData)); +vs.addLast(v); +} +var n = vs.size(); +if (n > 0) { +jvxlData.vContours = JU.AU.createArrayOfArrayList(n); +jvxlData.contourColixes = this.params.contourColixes = Clazz.newShortArray (n, 0); +jvxlData.contourValues = this.params.contoursDiscrete = Clazz.newFloatArray (n, 0); +for (var i = 0; i < n; i++) { +jvxlData.vContours[i] = vs.get(i); +jvxlData.contourValues[i] = (jvxlData.vContours[i].get(2)).floatValue(); +jvxlData.contourColixes[i] = (jvxlData.vContours[i].get(3))[0]; +} +jvxlData.contourColors = JU.C.getHexCodes(jvxlData.contourColixes); +JU.Logger.info("JVXL read: " + n + " discrete contours"); +JU.Logger.info("JVXL read: contour values: " + values); +JU.Logger.info("JVXL read: contour colors: " + colors); +}}, "J.jvxl.data.JvxlData,~S"); +Clazz.overrideMethod(c$, "postProcessVertices", +function(){ +var bsInvalid = this.params.bsExcluded[1]; +if (bsInvalid != null) { +if (this.meshDataServer != null) this.meshDataServer.fillMeshData(this.meshData, 1, null); +this.meshData.invalidateVertices(bsInvalid); +if (this.meshDataServer != null) { +this.meshDataServer.fillMeshData(this.meshData, 4, null); +this.meshData = new J.jvxl.data.MeshData(); +}this.updateTriangles(); +}}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/KinemageReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/KinemageReader.js new file mode 100755 index 000000000000..6aa0fe107c03 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/KinemageReader.js @@ -0,0 +1,122 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.PmeshReader"], "J.jvxl.readers.KinemageReader", ["JU.CU", "$.P3", "$.PT", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.nDots = 0; +this.vMin = -3.4028235E38; +this.vMax = 3.4028235E38; +this.pointType = 0; +this.findString = null; +this.lastAtom = ""; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "KinemageReader", J.jvxl.readers.PmeshReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.KinemageReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2PR(sg, br); +this.type = "kinemage"; +this.setHeader(); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readVolumeParameters", +function(isMapData){ +if (this.params.parameters != null && this.params.parameters.length >= 2) { +this.vMin = this.params.parameters[1]; +this.vMax = (this.params.parameters.length >= 3 ? this.params.parameters[2] : this.vMin); +this.pointType = (this.params.parameters.length >= 4 ? Clazz.floatToInt(this.params.parameters[3]) : 0); +this.findString = this.params.calculationType; +}return true; +}, "~B"); +Clazz.overrideMethod(c$, "readVertices", +function(){ +this.rd(); +var n0; +while (this.line != null) { +if (this.line.length != 0 && this.line.charAt(0) == '@') { +JU.Logger.info(this.line); +if (this.line.indexOf("contact}") >= 0 || this.line.indexOf("overlap}") >= 0 || this.line.indexOf("H-bonds}") >= 0) { +if (this.line.indexOf("@dotlist") == 0) { +n0 = this.nDots; +this.readDots(); +if (this.nDots > n0) JU.Logger.info("dots: " + (this.nDots - n0) + "/" + this.nDots); +continue; +} else if (this.line.indexOf("@vectorlist") == 0) { +n0 = this.nPolygons; +this.readVectors(); +if (this.nPolygons > n0) JU.Logger.info("lines: " + (this.nPolygons - n0) + "/" + this.nPolygons); +continue; +}}}this.rd(); +} +return true; +}); +Clazz.defineMethod(c$, "readDots", +function(){ +var color = Clazz.newIntArray (1, 0); +while (this.rd() != null && this.line.indexOf('@') < 0) { +var i = this.getPoint(this.line, 2, color, true); +if (i < 0) continue; +this.nDots++; +this.nTriangles = this.addTriangleCheck(i, i, i, 7, 0, false, color[0]); +} +}); +Clazz.defineMethod(c$, "readVectors", +function(){ +var color = Clazz.newIntArray (1, 0); +while (this.rd() != null && this.line.indexOf('@') < 0) { +var ia = this.getPoint(this.line, 3, color, true); +var ib = this.getPoint(this.line.substring(this.line.lastIndexOf('{')), 2, color, false); +if (ia < 0 || ib < 0) continue; +this.nPolygons++; +this.nTriangles = this.addTriangleCheck(ia, ib, ib, 7, 0, false, color[0]); +} +}); +Clazz.defineMethod(c$, "getPoint", +function(line, i, retColor, checkType){ +if (this.findString != null) { +var atom = line.substring(0, line.indexOf("}") + 1); +if (atom.length < 4) atom = this.lastAtom; + else this.lastAtom = atom; +if (atom.indexOf(this.findString) < 0) return -1; +}var tokens = JU.PT.getTokens(line.substring(line.indexOf("}") + 1)); +var value = this.assignValueFromGapColorForKin(tokens[0]); +if (Float.isNaN(value)) return -1; +if (checkType && this.pointType != 0) { +switch ((tokens[i - 1].charAt(1)).charCodeAt(0)) { +case 77: +if (this.pointType != 1) return -1; +break; +case 83: +if (this.pointType != 2) return -1; +break; +case 80: +if (this.pointType != 3) return -1; +break; +case 79: +if (this.pointType != 4) return -1; +break; +default: +return -1; +} +}retColor[0] = this.getColor(tokens[0]); +tokens = JU.PT.getTokens(tokens[i].$replace(',', ' ')); +var pt = JU.P3.new3(JU.PT.parseFloat(tokens[0]), JU.PT.parseFloat(tokens[1]), JU.PT.parseFloat(tokens[2])); +if (this.isAnisotropic) this.setVertexAnisotropy(pt); +return this.addVertexCopy(pt, value, this.nVertices++, false); +}, "~S,~N,~A,~B"); +Clazz.defineMethod(c$, "getColor", +function(color){ +if (color.equals("sky")) color = "skyblue"; + else if (color.equals("sea")) color = "seagreen"; +return JU.CU.getArgbFromString(color); +}, "~S"); +Clazz.defineMethod(c$, "assignValueFromGapColorForKin", +function(color){ +var value = (color.equals("greentint") ? 4 : color.equals("blue") ? 0.35 : color.equals("sky") ? 0.25 : color.equals("sea") ? 0.15 : color.equals("green") ? 0.0 : color.equals("yellowtint") ? -0.1 : color.equals("yellow") ? -0.2 : color.equals("orange") ? -0.3 : color.equals("red") ? -0.4 : -0.5); +return (value >= this.vMin && value <= this.vMax ? value : NaN); +}, "~S"); +Clazz.overrideMethod(c$, "readPolygons", +function(){ +return true; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/MapFileReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/MapFileReader.js new file mode 100755 index 000000000000..f1e8ed831d77 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/MapFileReader.js @@ -0,0 +1,108 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.VolumeFileReader", "JU.P3"], "J.jvxl.readers.MapFileReader", ["JU.Logger", "$.SimpleUnitCell"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.dmin = 3.4028235E38; +this.dmax = 0; +this.dmean = 0; +this.drange = 0; +this.mapc = 0; +this.mapr = 0; +this.maps = 0; +this.n0 = 0; +this.n1 = 0; +this.n2 = 0; +this.mode = 0; +this.xyzStart = null; +this.na = 0; +this.nb = 0; +this.nc = 0; +this.a = 0; +this.b = 0; +this.c = 0; +this.alpha = 0; +this.beta = 0; +this.gamma = 0; +this.origin = null; +this.vectors = null; +this.xIndex = -1; +this.yIndex = 0; +this.zIndex = 0; +this.p3 = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "MapFileReader", J.jvxl.readers.VolumeFileReader); +Clazz.prepareFields (c$, function(){ +this.xyzStart = Clazz.newFloatArray (3, 0); +this.origin = new JU.P3(); +this.vectors = new Array(3); +this.p3 = new JU.P3(); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.MapFileReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2MFR(sg, br); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.defineMethod(c$, "init2MFR", +function(sg, br){ +this.init2VFR(sg, br); +this.isAngstroms = true; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.defineMethod(c$, "checkInsideOut", +function(mapc, mapr, maps){ +if (this.params.thePlane == null) this.params.insideOut = (";123;231;312;".indexOf(";" + mapc + mapr + maps) >= 0); +}, "~N,~N,~N"); +Clazz.defineMethod(c$, "getVectorsAndOrigin", +function(){ +this.checkInsideOut(this.mapc, this.mapr, this.maps); +JU.Logger.info("grid parameters: nx,ny,nz: " + this.n0 + "," + this.n1 + "," + this.n2); +JU.Logger.info("grid parameters: nxStart,nyStart,nzStart: " + this.xyzStart[0] + "," + this.xyzStart[1] + "," + this.xyzStart[2]); +JU.Logger.info("grid parameters: mx,my,mz: " + this.na + "," + this.nb + "," + this.nc); +JU.Logger.info("grid parameters: a,b,c,alpha,beta,gamma: " + this.a + "," + this.b + "," + this.c + "," + this.alpha + "," + this.beta + "," + this.gamma); +JU.Logger.info("grid parameters: mapc,mapr,maps: " + this.mapc + "," + this.mapr + "," + this.maps); +JU.Logger.info("grid parameters: originX,Y,Z: " + this.origin); +var unitCell = JU.SimpleUnitCell.newA( Clazz.newFloatArray(-1, [this.a / this.na, this.b / this.nb, this.c / this.nc, this.alpha, this.beta, this.gamma])); +this.vectors[0] = JU.P3.new3(1, 0, 0); +this.vectors[1] = JU.P3.new3(0, 1, 0); +this.vectors[2] = JU.P3.new3(0, 0, 1); +unitCell.toCartesian(this.vectors[0], false); +unitCell.toCartesian(this.vectors[1], false); +unitCell.toCartesian(this.vectors[2], false); +JU.Logger.info("Jmol unit cell vectors:"); +JU.Logger.info(" a: " + this.vectors[0]); +JU.Logger.info(" b: " + this.vectors[1]); +JU.Logger.info(" c: " + this.vectors[2]); +this.voxelCounts[0] = this.n2; +this.voxelCounts[1] = this.n1; +this.voxelCounts[2] = this.n0; +this.volumetricVectors[0].setT(this.vectors[this.maps - 1]); +this.volumetricVectors[1].setT(this.vectors[this.mapr - 1]); +this.volumetricVectors[2].setT(this.vectors[this.mapc - 1]); +if (this.origin.x == 0 && this.origin.y == 0 && this.origin.z == 0) { +if (this.xIndex == -1) { +var xyz2crs = Clazz.newIntArray (3, 0); +xyz2crs[this.mapc - 1] = 0; +xyz2crs[this.mapr - 1] = 1; +xyz2crs[this.maps - 1] = 2; +this.xIndex = xyz2crs[0]; +this.yIndex = xyz2crs[1]; +this.zIndex = xyz2crs[2]; +}this.origin.scaleAdd2(this.xyzStart[this.xIndex], this.vectors[0], this.origin); +this.origin.scaleAdd2(this.xyzStart[this.yIndex], this.vectors[1], this.origin); +this.origin.scaleAdd2(this.xyzStart[this.zIndex], this.vectors[2], this.origin); +}this.volumetricOrigin.setT(this.origin); +JU.Logger.info("Jmol grid origin in Cartesian coordinates: " + this.origin); +JU.Logger.info("Use isosurface OFFSET {x y z} if you want to shift it.\n"); +this.p3.set(this.na, this.nb, this.nc); +unitCell.toCartesian(this.p3, true); +this.p3.add(this.origin); +JU.Logger.info("boundbox corners " + this.origin + " " + this.p3 + ";draw bbox boundbox mesh nofill"); +}); +Clazz.defineMethod(c$, "setCutoffAutomatic", +function(){ +if (this.params.thePlane == null && this.params.cutoffAutomatic) { +this.params.cutoff = -1.0; +JU.Logger.info("MapReader: setting cutoff to default value of " + this.params.cutoff + (this.boundingBox == null ? " (no BOUNDBOX parameter)\n" : "\n")); +}}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/MrcBinaryReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/MrcBinaryReader.js new file mode 100755 index 000000000000..8ceaf1bd45d7 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/MrcBinaryReader.js @@ -0,0 +1,178 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.MapFileReader"], "J.jvxl.readers.MrcBinaryReader", ["JU.SB", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.labels = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "MrcBinaryReader", J.jvxl.readers.MapFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.MrcBinaryReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +var fileName = (sg.getReaderData())[0]; +this.init2MFR(sg, br); +this.binarydoc = this.newBinaryDocument(); +this.setStream(fileName, true); +this.nSurfaces = 1; +if (this.params.thePlane == null) this.params.insideOut = !this.params.insideOut; +this.allowSigma = true; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +var ispg; +var nsymbt; +var extra = Clazz.newByteArray (100, 0); +var map = Clazz.newByteArray (4, 0); +var machst = Clazz.newByteArray (4, 0); +var rmsDeviation; +var nlabel; +this.n0 = this.binarydoc.readInt(); +if (this.n0 < 0 || this.n0 > 256) { +this.setStream(null, false); +this.n0 = this.binarydoc.swapBytesI(this.n0); +if (this.n0 < 0 || this.n0 > 1000) { +JU.Logger.info("nx=" + this.n0 + " not displayable as MRC file"); +throw new Exception("MRC file type not readable"); +}JU.Logger.info("reading little-endian MRC file"); +}this.n1 = this.binarydoc.readInt(); +this.n2 = this.binarydoc.readInt(); +this.mode = this.binarydoc.readInt(); +if (this.mode < 0 || this.mode > 6) { +this.setStream(null, false); +this.n0 = this.binarydoc.swapBytesI(this.n0); +this.n1 = this.binarydoc.swapBytesI(this.n1); +this.n2 = this.binarydoc.swapBytesI(this.n2); +this.mode = this.binarydoc.swapBytesI(this.mode); +}JU.Logger.info("MRC header: mode: " + this.mode); +JU.Logger.info("MRC header: nx ny nz: " + this.n0 + " " + this.n1 + " " + this.n2); +this.xyzStart[0] = this.binarydoc.readInt(); +this.xyzStart[1] = this.binarydoc.readInt(); +this.xyzStart[2] = this.binarydoc.readInt(); +JU.Logger.info("MRC header: nxyzStart: " + this.xyzStart[0] + " " + this.xyzStart[1] + " " + this.xyzStart[2]); +this.na = this.binarydoc.readInt(); +this.nb = this.binarydoc.readInt(); +this.nc = this.binarydoc.readInt(); +if (this.na == 0) this.na = this.n0 - 1; +if (this.nb == 0) this.nb = this.n1 - 1; +if (this.nc == 0) this.nc = this.n2 - 1; +JU.Logger.info("MRC header: na nb nc: " + this.na + " " + this.nb + " " + this.nc); +this.a = this.binarydoc.readFloat(); +this.b = this.binarydoc.readFloat(); +this.c = this.binarydoc.readFloat(); +this.alpha = this.binarydoc.readFloat(); +this.beta = this.binarydoc.readFloat(); +this.gamma = this.binarydoc.readFloat(); +if (this.alpha == 0) { +this.alpha = this.beta = this.gamma = 90; +JU.Logger.info("MRC header: alpha,beta,gamma 0 changed to 90,90,90"); +JU.Logger.info("MRC header: alpha,beta,gamma 0 reversing insideOut sense"); +if (this.params.thePlane == null) this.params.insideOut = !this.params.insideOut; +}this.mapc = this.binarydoc.readInt(); +this.mapr = this.binarydoc.readInt(); +this.maps = this.binarydoc.readInt(); +if (this.mapc == 2 && this.mapr == 1 && this.params.thePlane == null) this.params.insideOut = !this.params.insideOut; +var s = "" + this.mapc + this.mapr + this.maps; +JU.Logger.info("MRC header: mapc mapr maps: " + s); +if (this.params.thePlane == null && "21321".indexOf(s) >= 1) { +JU.Logger.info("MRC header: data are xy-reversed"); +this.params.dataXYReversed = true; +}this.dmin = this.binarydoc.readFloat(); +this.dmax = this.binarydoc.readFloat(); +this.dmean = this.binarydoc.readFloat(); +JU.Logger.info("MRC header: dmin,dmax,dmean: " + this.dmin + "," + this.dmax + "," + this.dmean); +ispg = this.binarydoc.readInt(); +nsymbt = this.binarydoc.readInt(); +JU.Logger.info("MRC header: ispg,nsymbt: " + ispg + "," + nsymbt); +this.binarydoc.readByteArray(extra, 0, extra.length); +this.origin.x = this.binarydoc.readFloat(); +this.origin.y = this.binarydoc.readFloat(); +this.origin.z = this.binarydoc.readFloat(); +JU.Logger.info("MRC header: origin: " + this.origin); +this.binarydoc.readByteArray(map, 0, map.length); +this.binarydoc.readByteArray(machst, 0, machst.length); +rmsDeviation = this.binarydoc.readFloat(); +JU.Logger.info("MRC header: rms: " + rmsDeviation); +nlabel = this.binarydoc.readInt(); +JU.Logger.info("MRC header: labels: " + nlabel); +this.labels = new Array(nlabel); +if (nlabel > 0) this.labels[0] = "Jmol MrcBinaryReader"; +for (var i = 0; i < 10; i++) { +s = this.binarydoc.readString(80).trim(); +if (i < nlabel) { +this.labels[i] = s; +JU.Logger.info(this.labels[i]); +}} +for (var i = 0; i < nsymbt; i += 80) { +var position = this.binarydoc.getPosition(); +s = this.binarydoc.readString(80).trim(); +if (s.indexOf('\0') != s.lastIndexOf('\0')) { +JU.Logger.error("File indicates " + nsymbt + " symmetry lines, but " + i + " found!"); +this.binarydoc.seek(position); +break; +}JU.Logger.info("MRC file symmetry information: " + s); +} +JU.Logger.info("MRC header: bytes read: " + this.binarydoc.getPosition() + "\n"); +this.getVectorsAndOrigin(); +this.jvxlFileHeaderBuffer = new JU.SB(); +this.jvxlFileHeaderBuffer.append("MRC DATA ").append(nlabel > 0 ? this.labels[0] : "").append("\n"); +this.jvxlFileHeaderBuffer.append("see http://ami.scripps.edu/software/mrctools/mrc_specification.php\n"); +if (this.params.thePlane == null && (this.params.cutoffAutomatic || !Float.isNaN(this.params.sigma))) { +var sigma = (this.params.sigma < 0 || Float.isNaN(this.params.sigma) ? 1 : this.params.sigma); +this.params.cutoff = rmsDeviation * sigma + this.dmean; +s = "cutoff set to " + this.params.cutoff + " (mean + rmsDeviation*sigma = " + this.dmean + " + " + rmsDeviation + "*" + sigma + ")"; +JU.Logger.info(s); +this.jvxlFileHeaderBuffer.append(s + "\n"); +}}); +Clazz.overrideMethod(c$, "nextVoxel", +function(){ +var voxelValue; +switch (this.mode) { +case 0: +voxelValue = this.binarydoc.readByte(); +break; +case 1: +voxelValue = this.binarydoc.readShort(); +break; +default: +case 2: +voxelValue = this.binarydoc.readFloat(); +break; +case 3: +voxelValue = this.binarydoc.readShort(); +this.binarydoc.readShort(); +break; +case 4: +voxelValue = this.binarydoc.readFloat(); +this.binarydoc.readFloat(); +break; +case 6: +voxelValue = this.binarydoc.readUnsignedShort(); +break; +} +this.nBytes = this.binarydoc.getPosition(); +return voxelValue; +}); +Clazz.overrideMethod(c$, "skipData", +function(nPoints){ +for (var i = 0; i < nPoints; i++) switch (this.mode) { +case 0: +this.binarydoc.readByte(); +break; +case 1: +case 6: +this.binarydoc.readByteArray(J.jvxl.readers.MrcBinaryReader.b8, 0, 2); +break; +default: +case 2: +case 3: +this.binarydoc.readByteArray(J.jvxl.readers.MrcBinaryReader.b8, 0, 4); +break; +case 4: +this.binarydoc.readByteArray(J.jvxl.readers.MrcBinaryReader.b8, 0, 8); +break; +} + +}, "~N"); +c$.b8 = Clazz.newByteArray (8, 0); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/MsmsReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/MsmsReader.js new file mode 100755 index 000000000000..f08b414b3ff9 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/MsmsReader.js @@ -0,0 +1,54 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.PmeshReader"], "J.jvxl.readers.MsmsReader", ["JU.PT", "$.Rdr", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.fileName = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "MsmsReader", J.jvxl.readers.PmeshReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.MsmsReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2PFR(sg, br); +this.fileName = (sg.getReaderData())[0]; +if (this.fileName == null) return; +this.type = "msms"; +this.onePerLine = true; +this.fixedCount = 3; +this.vertexBase = 1; +this.setHeader(); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readVertices", +function(){ +this.skipHeader(); +return this.readVerticesPM(); +}); +Clazz.overrideMethod(c$, "readPolygons", +function(){ +this.br.close(); +this.fileName = JU.PT.rep(this.fileName, ".vert", ".face"); +JU.Logger.info("reading from file " + this.fileName); +try { +this.br = JU.Rdr.getBufferedReader(this.sg.atomDataServer.getBufferedInputStream(this.fileName), null); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.info("Note: file " + this.fileName + " was not found"); +this.br = null; +return true; +} else { +throw e; +} +} +this.sg.addRequiredFile(this.fileName); +this.skipHeader(); +return this.readPolygonsPM(); +}); +Clazz.defineMethod(c$, "skipHeader", +function(){ +while (this.rd() != null && this.line.indexOf("#") >= 0) { +} +this.tokens = this.getTokens(); +this.iToken = 0; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/NffReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/NffReader.js new file mode 100755 index 000000000000..32225a0547d9 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/NffReader.js @@ -0,0 +1,75 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.PolygonFileReader", "java.util.Hashtable", "JU.P3"], "J.jvxl.readers.NffReader", ["JU.CU", "J.jvxl.data.JvxlCoder", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.nPolygons = 0; +this.vertexMap = null; +this.pt = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "NffReader", J.jvxl.readers.PolygonFileReader); +Clazz.prepareFields (c$, function(){ +this.vertexMap = new java.util.Hashtable(); +this.pt = new JU.P3(); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.NffReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2PFR(sg, br); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.defineMethod(c$, "setHeader", +function(){ +this.jvxlFileHeaderBuffer.append("NFF file format\nvertices and triangles only\n"); +J.jvxl.data.JvxlCoder.jvxlCreateHeaderWithoutTitleOrAtoms(this.volumeData, this.jvxlFileHeaderBuffer); +}); +Clazz.overrideMethod(c$, "getSurfaceData", +function(){ +if (this.readVerticesAndPolygons()) JU.Logger.info("NFF file contains " + this.nVertices + " vertices and " + this.nTriangles + " triangles"); + else JU.Logger.error(this.params.fileName + ": Error reading Nff data "); +}); +Clazz.defineMethod(c$, "readVerticesAndPolygons", +function(){ +var color = 0xFF0000; +try { +while (this.rd() != null) { +if (this.line.length == 0) continue; +var tokens = this.getTokens(); +switch ((this.line.charAt(0)).charCodeAt(0)) { +case 35: +this.vertexMap.clear(); +continue; +case 102: +color = JU.CU.colorTriadToFFRGB(this.parseFloatStr(tokens[1]), this.parseFloatStr(tokens[2]), this.parseFloatStr(tokens[3])); +continue; +case 112: +if (this.line.equals("pp 3")) { +var i1 = this.getVertex(); +var i2 = this.getVertex(); +var i3 = this.getVertex(); +this.nTriangles++; +this.addTriangleCheck(i1, i2, i3, 7, 0, false, color); +}continue; +} +} +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +return true; +}); +Clazz.defineMethod(c$, "getVertex", +function(){ +var i = this.vertexMap.get(this.rd()); +if (i == null) { +var tokens = this.getTokens(); +this.pt.set(this.parseFloatStr(tokens[0]), this.parseFloatStr(tokens[1]), this.parseFloatStr(tokens[2])); +if (!Float.isNaN(this.params.scale)) this.pt.scale(this.params.scale); +if (this.isAnisotropic) this.setVertexAnisotropy(this.pt); +i = Integer.$valueOf(this.addVertexCopy(this.pt, 0, this.nVertices++, true)); +this.vertexMap.put(this.line, i); +}return i.intValue(); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/ObjReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/ObjReader.js new file mode 100755 index 000000000000..05bed82d8a9f --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/ObjReader.js @@ -0,0 +1,100 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.PmeshReader"], "J.jvxl.readers.ObjReader", ["java.util.Hashtable", "JU.BS", "$.CU", "$.P3", "$.PT"], function(){ +var c$ = Clazz.declareType(J.jvxl.readers, "ObjReader", J.jvxl.readers.PmeshReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.ObjReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2PR(sg, br); +this.type = "obj"; +this.setHeader(); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readVertices", +function(){ +this.pmeshError = "pmesh ERROR: invalid vertex/face list"; +var pt = new JU.P3(); +var color = 0; +var ia; +var ib; +var ic; +var id = 0; +var i = 0; +var nPts = 0; +var htPymol = new java.util.Hashtable(); +var ipt = null; +var spt = null; +var pymolMap = Clazz.newIntArray (3, 0); +var bsOK = new JU.BS(); +while (this.rd() != null) { +if (this.line.length < 2 || this.line.charAt(1) != ' ') { +if (this.params.readAllData && this.line.startsWith("usemtl")) color = JU.CU.getArgbFromString("[x" + this.line.substring(8) + "]"); +continue; +}switch ((this.line.charAt(0)).charCodeAt(0)) { +case 118: +this.next[0] = 2; +pt.set(JU.PT.parseFloatNext(this.line, this.next), JU.PT.parseFloatNext(this.line, this.next), JU.PT.parseFloatNext(this.line, this.next)); +var addHt = false; +if (htPymol == null) { +i = this.nVertices; +} else if ((ipt = htPymol.get(spt = "" + pt)) == null) { +addHt = true; +i = this.nVertices; +} else { +i = ipt.intValue(); +}var j = i; +if (i == this.nVertices) { +if (this.isAnisotropic) this.setVertexAnisotropy(pt); +j = this.addVertexCopy(pt, 0, this.nVertices++, true); +if (j >= 0) bsOK.set(i); +}pymolMap[nPts % 3] = j; +if (addHt) htPymol.put(spt, Integer.$valueOf(i)); +nPts++; +if (htPymol != null && nPts > 3) htPymol = null; +break; +case 102: +if (nPts == 3 && this.line.indexOf("//") < 0) htPymol = null; +nPts = 0; +this.nPolygons++; +var tokens = JU.PT.getTokens(this.line); +var vertexCount = tokens.length - 1; +if (vertexCount == 4) htPymol = null; +if (htPymol == null) { +ia = JU.PT.parseInt(tokens[1]) - 1; +ib = JU.PT.parseInt(tokens[2]) - 1; +ic = JU.PT.parseInt(tokens[3]) - 1; +this.pmeshError = " " + ia + " " + ib + " " + ic + " " + this.line; +if (!bsOK.get(ia) || !bsOK.get(ib) || !bsOK.get(ic)) continue; +if (vertexCount == 4) { +id = JU.PT.parseInt(tokens[4]) - 1; +var isOK = (bsOK.get(id)); +this.nTriangles = this.addTriangleCheck(ia, ib, ic, (isOK ? 3 : 7), 0, false, color); +if (isOK) this.nTriangles = this.addTriangleCheck(ia, ic, id, 6, 0, false, color); +continue; +}} else { +ia = pymolMap[0]; +ib = pymolMap[1]; +ic = pymolMap[2]; +if (ia < 0 || ib < 0 || ic < 0) continue; +}this.nTriangles = this.addTriangleCheck(ia, ib, ic, 7, 0, false, color); +break; +case 103: +htPymol = null; +if (this.params.readAllData) try { +color = JU.PT.parseIntRadix(this.line.substring(3), 16); +} catch (e) { +color = 0; +} +break; +} +} +this.pmeshError = null; +return true; +}); +Clazz.overrideMethod(c$, "readPolygons", +function(){ +return true; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/Parameters.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/Parameters.js new file mode 100755 index 000000000000..d5110f73d9a4 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/Parameters.js @@ -0,0 +1,549 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(null, "J.jvxl.readers.Parameters", ["java.util.Hashtable", "JU.A4", "$.Lst", "$.M3", "$.P3", "$.P4", "$.V3", "JU.Escape", "$.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.state = 0; +this.testFlags = 0; +this.logMessages = false; +this.logCompression = false; +this.logCube = false; +this.isSilent = false; +this.assocCutoff = 0.3; +this.dataType = 0; +this.surfaceType = 0; +this.calculationType = ""; +this.atomRadiusData = null; +this.addHydrogens = false; +this.solventRadius = 0; +this.solventExtendedAtomRadius = 0; +this.propertySmoothing = false; +this.propertySmoothingPower = 4; +this.envelopeRadius = 0; +this.cavityRadius = 0; +this.isCavity = false; +this.pocket = null; +this.minSet = 0; +this.slabInfo = null; +this.slabPlaneOffset = NaN; +this.theProperty = null; +this.solvent_ptsPerAngstrom = 4; +this.solvent_gridMax = 60; +this.plane_ptsPerAngstrom = 4; +this.plane_gridMax = 81; +this.colorBySign = false; +this.colorByPhase = false; +this.colorBySets = false; +this.colorRgb = 0; +this.colorNeg = 0; +this.colorPos = 0; +this.colorPosLCAO = 0; +this.colorNegLCAO = 0; +this.colorPhase = 0; +this.colorDensity = false; +this.iAddGridPoints = false; +this.atomIndex = 0; +this.isAngstroms = false; +this.scale = 0; +this.scale3d = 0; +this.anisotropy = null; +this.isAnisotropic = false; +this.eccentricityMatrix = null; +this.eccentricityMatrixInverse = null; +this.isEccentric = false; +this.eccentricityScale = 0; +this.eccentricityRatio = 0; +this.aniosU = null; +this.anisoB = null; +this.lcaoType = null; +this.functionInfo = null; +this.psi_n = 2; +this.psi_l = 1; +this.psi_m = 1; +this.psi_Znuc = 1; +this.psi_ptsPerAngstrom = 5; +this.psi_monteCarloCount = 0; +this.mep_gridMax = 40; +this.mep_ptsPerAngstrom = 3; +this.mep_marginAngstroms = 1; +this.mep_calcType = -1; +this.qmOrbitalType = 0; +this.qmOrbitalCount = 0; +this.moData = null; +this.qm_gridMax = 80; +this.qm_ptsPerAngstrom = 10; +this.qm_marginAngstroms = 1; +this.qm_nAtoms = 0; +this.qm_moNumber = 2147483647; +this.qm_moLinearCombination = null; +this.center = null; +this.point = null; +this.distance = 0; +this.allowVolumeRender = false; +this.script = null; +this.bsSelected = null; +this.bsIgnore = null; +this.bsSolvent = null; +this.func = null; +this.title = null; +this.blockCubeData = false; +this.readAllData = false; +this.fileIndex = -1; +this.fileName = null; +this.modelIndex = -1; +this.modelInvRotation = null; +this.isXLowToHigh = false; +this.insideOut = false; +this.dataXYReversed = false; +this.cutoff = 3.4028235E38; +this.cutoffRange = null; +this.sigma = 3.4028235E38; +this.cutoffAutomatic = true; +this.isCutoffAbsolute = false; +this.isPositiveOnly = false; +this.rangeAll = false; +this.rangeSelected = false; +this.rangeDefined = false; +this.valueMappedToRed = 0; +this.valueMappedToBlue = 0; +this.mappedDataMin = 0; +this.mappedDataMax = 0; +this.isColorReversed = false; +this.isBicolorMap = false; +this.isSquared = false; +this.isSquaredLinear = false; +this.thePlane = null; +this.isContoured = false; +this.nContours = 0; +this.thisContour = 0; +this.contourFromZero = false; +this.parameters = null; +this.resolution = 0; +this.downsampleFactor = 0; +this.maxSet = 0; +this.contoursDiscrete = null; +this.contourColixes = null; +this.contourIncrements = null; +this.boundingBox = null; +this.bsExcluded = null; +this.contourType = 0; +this.colorSchemeTranslucent = false; +this.colorEncoder = null; +this.usePropertyForColorRange = true; +this.isPeriodic = false; +this.doFullMolecular = false; +this.propertyDistanceMax = 2147483647; +this.randomSeed = 0; +this.fullyLit = false; +this.vertexSource = null; +this.intersection = null; +this.origin = null; +this.steps = null; +this.points = null; +this.volumeData = null; +this.contactPair = null; +this.mapLattice = null; +this.extendGrid = 0; +this.isMapped = false; +this.showTiming = false; +this.pointSize = 0; +this.probes = null; +this.isModelConnected = false; +this.surfaceAtoms = null; +this.filesData = null; +this.probeValues = null; +this.sbOut = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "Parameters", null); +Clazz.prepareFields (c$, function(){ +this.anisotropy = Clazz.newFloatArray (3, 0); +}); +Clazz.defineMethod(c$, "initialize", +function(){ +this.addHydrogens = false; +this.allowVolumeRender = true; +this.atomRadiusData = null; +this.atomIndex = -1; +this.blockCubeData = false; +this.boundingBox = null; +this.bsExcluded = new Array(4); +this.bsIgnore = null; +this.bsSelected = null; +this.bsSolvent = null; +this.calculationType = ""; +this.center = new JU.P3(); +this.resetForMapping(true); +this.colorBySign = this.colorByPhase = this.colorBySets = false; +this.colorEncoder = null; +this.colorNeg = -65536; +this.colorNegLCAO = -8388480; +this.colorPos = -16776961; +this.colorPosLCAO = -23296; +this.colorRgb = -2147483648; +this.colorSchemeTranslucent = false; +this.contactPair = null; +this.contourIncrements = null; +this.contoursDiscrete = null; +this.contourColixes = null; +this.contourFromZero = true; +this.cutoff = 3.4028235E38; +this.cutoffAutomatic = true; +this.dataXYReversed = false; +this.distance = 3.4028235E38; +this.doFullMolecular = false; +this.envelopeRadius = 10; +this.extendGrid = 0; +this.fileIndex = 1; +this.readAllData = true; +this.fileName = ""; +this.filesData = null; +this.fullyLit = false; +this.functionInfo = null; +this.iAddGridPoints = false; +this.insideOut = false; +this.isAngstroms = false; +this.isBicolorMap = this.isCutoffAbsolute = this.isPositiveOnly = false; +this.isCavity = false; +this.isColorReversed = false; +this.isModelConnected = false; +this.isSquared = false; +this.isSquaredLinear = false; +this.isContoured = false; +this.isEccentric = false; +this.isMapped = false; +this.isPeriodic = false; +this.isSilent = false; +this.logCube = this.logCompression = false; +this.logMessages = JU.Logger.debugging; +this.mapLattice = null; +this.mep_calcType = -1; +this.minSet = 0; +this.modelIndex = -1; +this.modelInvRotation = null; +this.nContours = 0; +this.pocket = null; +this.pointSize = NaN; +this.probes = null; +this.probeValues = null; +this.propertyDistanceMax = 2147483647; +this.propertySmoothing = false; +this.propertySmoothingPower = 4; +this.rangeDefined = false; +this.rangeAll = false; +this.rangeSelected = false; +this.resolution = 3.4028235E38; +this.scale = NaN; +this.scale3d = 0; +this.sigma = NaN; +this.slabInfo = null; +this.solventExtendedAtomRadius = 0; +this.state = 1; +this.testFlags = 0; +this.thePlane = null; +this.theProperty = null; +this.thisContour = -1; +this.title = null; +this.usePropertyForColorRange = true; +this.vertexSource = null; +}); +Clazz.defineMethod(c$, "resetForMapping", +function(haveSurface){ +if (!haveSurface) this.state = 2; +this.center.x = NaN; +this.colorDensity = false; +this.func = null; +this.intersection = null; +this.isAnisotropic = false; +this.isMapped = true; +this.mappedDataMin = 3.4028235E38; +this.origin = null; +this.parameters = null; +this.points = null; +this.qmOrbitalType = 0; +this.steps = null; +this.volumeData = null; +}, "~B"); +Clazz.defineMethod(c$, "setAnisotropy", +function(pt){ +this.anisotropy[0] = pt.x; +this.anisotropy[1] = pt.y; +this.anisotropy[2] = pt.z; +this.isAnisotropic = true; +if (Float.isNaN(this.center.x)) this.center.set(0, 0, 0); +}, "JU.P3"); +Clazz.defineMethod(c$, "setEccentricity", +function(info){ +var ecc = JU.V3.new3(info.x, info.y, info.z); +var c = (this.scale > 0 ? this.scale : info.w < 0 ? 1 : ecc.length()); +var fab_c = Math.abs(info.w); +ecc.normalize(); +var z = JU.V3.new3(0, 0, 1); +ecc.add(z); +ecc.normalize(); +if (Float.isNaN(ecc.x)) ecc.set(1, 0, 0); +this.eccentricityMatrixInverse = new JU.M3(); +this.eccentricityMatrixInverse.invertM(this.eccentricityMatrix = new JU.M3().setAA(JU.A4.newVA(ecc, 3.141592653589793))); +this.isEccentric = this.isAnisotropic = true; +this.eccentricityScale = c; +this.eccentricityRatio = fab_c; +if (fab_c > 1) this.eccentricityScale *= fab_c; +this.anisotropy[0] = fab_c * c; +this.anisotropy[1] = fab_c * c; +this.anisotropy[2] = c; +if (Float.isNaN(this.center.x)) this.center.set(0, 0, 0); +}, "JU.P4"); +Clazz.defineMethod(c$, "setPlane", +function(plane){ +this.thePlane = plane; +if (this.thePlane.x == 0 && this.thePlane.y == 0 && this.thePlane.z == 0) this.thePlane.z = 1; +this.isContoured = true; +}, "JU.P4"); +Clazz.defineMethod(c$, "setSphere", +function(radius, isGeodesic){ +this.dataType = (isGeodesic ? 74 : 65); +this.distance = radius; +this.setEccentricity(JU.P4.new4(0, 0, 1, 1)); +this.cutoff = 1.4E-45; +this.isCutoffAbsolute = false; +this.isSilent = !this.logMessages; +this.script = this.getScriptParams() + " SPHERE " + radius + ";"; +}, "~N,~B"); +Clazz.defineMethod(c$, "setEllipsoidP4", +function(v){ +this.dataType = 66; +this.distance = 1; +this.setEccentricity(v); +this.cutoff = 1.4E-45; +this.isCutoffAbsolute = false; +this.isSilent = !this.logMessages; +}, "JU.P4"); +Clazz.defineMethod(c$, "setEllipsoidAF", +function(bList){ +this.anisoB = bList; +this.dataType = 67; +this.distance = 0.3 * (Float.isNaN(this.scale) ? 1 : this.scale); +this.cutoff = 1.4E-45; +this.isCutoffAbsolute = false; +this.isSilent = !this.logMessages; +if (Float.isNaN(this.center.x)) this.center.set(0, 0, 0); +if (this.resolution == 3.4028235E38) this.resolution = 6; +}, "~A"); +Clazz.defineMethod(c$, "setLobe", +function(v){ +this.dataType = 68; +this.setEccentricity(v); +if (this.cutoff == 3.4028235E38) { +this.cutoff = 0.14; +if (this.isSquared) this.cutoff = this.cutoff * this.cutoff; +}this.isSilent = !this.logMessages; +this.script = this.getScriptParams() + " LOBE {" + v.x + " " + v.y + " " + v.z + " " + v.w + "};"; +}, "JU.P4"); +Clazz.defineMethod(c$, "getScriptParams", +function(){ +return " center " + JU.Escape.eP(this.center) + (Float.isNaN(this.scale) ? "" : " scale " + this.scale); +}); +Clazz.defineMethod(c$, "setLp", +function(v){ +this.dataType = 70; +this.setEccentricity(v); +if (this.cutoff == 3.4028235E38) { +this.cutoff = 0.14; +if (this.isSquared) this.cutoff = this.cutoff * this.cutoff; +}this.isSilent = !this.logMessages; +this.script = " center " + JU.Escape.eP(this.center) + (Float.isNaN(this.scale) ? "" : " scale " + this.scale) + " LP {" + v.x + " " + v.y + " " + v.z + " " + v.w + "};"; +}, "JU.P4"); +Clazz.defineMethod(c$, "setRadical", +function(v){ +this.dataType = 71; +this.setEccentricity(v); +if (this.cutoff == 3.4028235E38) { +this.cutoff = 0.14; +if (this.isSquared) this.cutoff = this.cutoff * this.cutoff; +}this.isSilent = !this.logMessages; +this.script = " center " + JU.Escape.eP(this.center) + (Float.isNaN(this.scale) ? "" : " scale " + this.scale) + " RAD {" + v.x + " " + v.y + " " + v.z + " " + v.w + "};"; +}, "JU.P4"); +Clazz.defineMethod(c$, "setLcao", +function(type, colorPtr){ +this.lcaoType = type; +if (colorPtr == 1) this.colorPosLCAO = this.colorNegLCAO; +this.isSilent = !this.logMessages; +}, "~S,~N"); +Clazz.defineMethod(c$, "setSolvent", +function(propertyName, radius){ +this.isEccentric = this.isAnisotropic = false; +this.solventRadius = Math.abs(radius); +this.dataType = (this.intersection != null ? 1333 : "nomap" === propertyName ? 1207 : "molecular" === propertyName ? 1203 : "sasurface" === propertyName || this.solventRadius == 0 ? 1196 : 1195); +if (this.state < 2 && (this.cutoffAutomatic || !this.colorDensity) && (this.intersection == null || this.cutoff == 3.4028235E38)) this.cutoff = 0.0; +switch (this.dataType) { +case 1333: +this.calculationType = "VDW intersection"; +break; +case 1207: +this.calculationType = "unmapped plane"; +break; +case 1203: +this.calculationType = "molecular surface with radius " + this.solventRadius; +if (this.minSet == 0) this.minSet = 50; +break; +case 1195: +this.calculationType = "solvent-excluded surface with radius " + this.solventRadius; +if (this.minSet == 0) this.minSet = 50; +break; +case 1196: +this.calculationType = "solvent-accessible surface with radius " + this.solventRadius; +if (this.minSet == 0) this.minSet = 50; +break; +} +switch (this.dataType) { +case 1207: +this.solventExtendedAtomRadius = this.solventRadius; +this.solventRadius = 0; +this.isContoured = false; +break; +case 1203: +this.solventExtendedAtomRadius = 0; +break; +case 1195: +this.solventExtendedAtomRadius = 0; +if (this.bsIgnore == null) this.bsIgnore = this.bsSolvent; + else if (this.bsSolvent != null) this.bsIgnore.or(this.bsSolvent); +break; +case 1196: +this.solventExtendedAtomRadius = this.solventRadius; +this.solventRadius = 0; +if (this.bsIgnore == null) this.bsIgnore = this.bsSolvent; + else if (this.bsSolvent != null) this.bsIgnore.or(this.bsSolvent); +break; +} +}, "~S,~N"); +Clazz.defineMethod(c$, "setFunctionXY", +function(value){ +this.dataType = 8; +this.functionInfo = value; +this.cutoff = 1.4E-45; +this.isEccentric = this.isAnisotropic = false; +}, "JU.Lst"); +Clazz.defineMethod(c$, "setFunctionXYZ", +function(value){ +this.dataType = 9; +this.functionInfo = value; +if (this.cutoff == 3.4028235E38) this.cutoff = 1.4E-45; +this.isEccentric = this.isAnisotropic = false; +}, "JU.Lst"); +Clazz.defineMethod(c$, "setAtomicOrbital", +function(nlmZprs){ +this.dataType = 1294; +this.setEccentricity(JU.P4.new4(0, 0, 1, 1)); +this.psi_n = Clazz.floatToInt(nlmZprs[0]); +this.psi_l = Clazz.floatToInt(nlmZprs[1]); +this.psi_m = Clazz.floatToInt(nlmZprs[2]); +this.psi_Znuc = nlmZprs[3]; +this.psi_monteCarloCount = Clazz.floatToInt(nlmZprs[4]); +this.distance = nlmZprs[5]; +if (this.distance != 0 || this.thePlane != null) this.allowVolumeRender = false; +this.randomSeed = Clazz.floatToInt(nlmZprs[6]); +this.psi_ptsPerAngstrom = 10; +if (this.cutoff == 3.4028235E38 || this.cutoff == 0.14) { +this.cutoff = (this.psi_monteCarloCount > 0 ? 0 : 0.04); +if (this.isSquared) this.cutoff = this.cutoff * this.cutoff; +}this.isCutoffAbsolute = true; +if (this.state < 2 && this.thePlane == null && this.colorBySign) this.isBicolorMap = true; +return (this.psi_Znuc > 0 && Math.abs(this.psi_m) <= this.psi_l && this.psi_l < this.psi_n); +}, "~A"); +Clazz.defineMethod(c$, "setMep", +function(charges, isMLP){ +this.dataType = (isMLP ? 1329 : 1328); +this.theProperty = charges; +this.usePropertyForColorRange = false; +this.isEccentric = this.isAnisotropic = false; +if (this.cutoff == 3.4028235E38) { +this.cutoff = 0.1; +if (this.isSquared) this.cutoff = this.cutoff * this.cutoff; +}this.isCutoffAbsolute = (this.cutoff > 0 && !this.isPositiveOnly); +this.contourFromZero = false; +if (this.state >= 2 || this.thePlane != null) { +if (!this.rangeDefined && !this.rangeAll) { +this.valueMappedToRed = -0.1; +this.valueMappedToBlue = 0.1; +this.rangeDefined = true; +}} else { +this.colorBySign = true; +this.isBicolorMap = true; +}}, "~A,~B"); +Clazz.defineMethod(c$, "setNci", +function(isPromolecular){ +this.fullyLit = true; +this.qm_gridMax = 200; +if (isPromolecular) this.dataType = 1844; +this.qm_marginAngstroms = 2; +this.qmOrbitalType = (isPromolecular ? 3 : 4); +if (isPromolecular) { +if (this.parameters == null || this.parameters.length < 2) this.parameters = Clazz.newFloatArray(-1, [this.cutoff, 2]); +}if (this.cutoff == 3.4028235E38 || this.cutoff == 0) this.cutoff = 0.3; +if (this.isSquared) this.cutoff *= this.cutoff; +if (this.title == null) this.title = new Array(0); +this.moData = new java.util.Hashtable(); +}, "~B"); +Clazz.defineMethod(c$, "setMO", +function(iMo, linearCombination){ +this.isModelConnected = true; +this.qm_moLinearCombination = linearCombination; +this.qm_moNumber = (linearCombination == null ? Math.abs(iMo) : Clazz.floatToInt(linearCombination[1])); +this.qmOrbitalType = (this.moData.containsKey("haveVolumeData") ? 5 : this.moData.containsKey("gaussians") ? 1 : this.moData.containsKey("slaters") ? 2 : 0); +var isElectronDensity = (iMo <= 0 && linearCombination == null); +if (this.qmOrbitalType == 0) { +JU.Logger.error("MO ERROR: No basis functions found in file for MO calculation. (GAUSSIAN 'gfprint' keyword may be missing?)"); +this.title = Clazz.newArray(-1, ["no basis functions found in file"]); +} else { +var mos = this.moData.get("mos"); +this.qmOrbitalCount = mos.size(); +this.calculationType = this.moData.get("calculationType"); +this.calculationType = "Molecular orbital #" + this.qm_moNumber + "/" + this.qmOrbitalCount + " " + (this.calculationType == null ? "" : this.calculationType); +if (!isElectronDensity) { +if (this.title == null) { +this.title = new Array(5); +this.title[0] = "%F"; +this.title[1] = "Model %M MO %I/%N %T"; +this.title[2] = "?Energy = %E %U"; +this.title[3] = "?Symmetry = %S"; +this.title[4] = "?Occupancy = %O"; +}}}this.dataType = 1837; +if (this.cutoff == 3.4028235E38) { +this.cutoff = (isElectronDensity ? 0.01 : 0.05); +}if (this.isSquared || this.isSquaredLinear) this.cutoff = this.cutoff * this.cutoff; +this.isEccentric = this.isAnisotropic = false; +this.isCutoffAbsolute = (this.cutoff > 0 && !this.isPositiveOnly); +if (this.state >= 2 || this.thePlane != null) return; +this.colorBySign = true; +if (this.colorByPhase && this.colorPhase == 0) this.colorByPhase = false; +this.isBicolorMap = true; +}, "~N,~A"); +Clazz.defineMethod(c$, "setMapRanges", +function(surfaceReader, haveData){ +if (!this.colorDensity) if (this.colorByPhase || this.colorBySign || (this.thePlane != null || this.isBicolorMap) && !this.isContoured) { +this.mappedDataMin = -1; +this.mappedDataMax = 1; +}if (this.mappedDataMin == 3.4028235E38 || this.mappedDataMin == this.mappedDataMax) { +var minMax = surfaceReader.getMinMaxMappedValues(haveData); +System.out.println("parameters - setmapranges " + minMax[0] + " " + minMax[1]); +this.mappedDataMin = minMax[0]; +this.mappedDataMax = minMax[1]; +}if (this.mappedDataMin == 0 && this.mappedDataMax == 0) { +this.mappedDataMin = -1; +this.mappedDataMax = 1; +}if (!this.rangeDefined) { +this.valueMappedToRed = this.mappedDataMin; +this.valueMappedToBlue = this.mappedDataMax; +}}, "J.jvxl.readers.SurfaceReader,~B"); +Clazz.defineMethod(c$, "addSlabInfo", +function(slabObject){ +if (this.slabInfo == null) this.slabInfo = new JU.Lst(); +this.slabInfo.addLast(slabObject); +}, "~A"); +Clazz.defineMethod(c$, "isInsideOut", +function(){ +return this.insideOut != this.dataXYReversed; +}); +Clazz.defineMethod(c$, "isFullyLit", +function(){ +return (this.thePlane != null || this.fullyLit); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PeriodicVolumeFileReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PeriodicVolumeFileReader.js new file mode 100755 index 000000000000..62390a42e831 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PeriodicVolumeFileReader.js @@ -0,0 +1,62 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.VolumeFileReader"], "J.jvxl.readers.PeriodicVolumeFileReader", null, function(){ +var c$ = Clazz.declareType(J.jvxl.readers, "PeriodicVolumeFileReader", J.jvxl.readers.VolumeFileReader); +Clazz.overrideMethod(c$, "readSurfaceData", +function(isMapData){ +this.initializeSurfaceData(); +this.newVoxelDataCube(); +this.getPeriodicVoxels(); +if (this.params.extendGrid != 0) { +var n = Clazz.newIntArray (3, 0); +var nx = this.nPointsX - 1; +var ny = this.nPointsY - 1; +var nz = this.nPointsZ - 1; +for (var i = 0; i < 3; i++) { +var vi = this.voxelCounts[i] - 1; +n[i] = Clazz.floatToInt(vi * this.params.extendGrid); +this.volumetricOrigin.scaleAdd2(-n[i], this.volumetricVectors[i], this.volumetricOrigin); +vi += 2 * n[i]; +while (n[i] > 0) n[i] -= this.voxelCounts[i] - 1; + +this.voxelCounts[i] = vi + 1; +} +this.nPointsX = this.voxelCounts[0]; +this.nPointsY = this.voxelCounts[1]; +this.nPointsZ = this.voxelCounts[2]; +var vd = Clazz.newFloatArray (this.nPointsX, this.nPointsY, this.nPointsZ, 0); +for (var i = this.nPointsX; --i >= 0; ) for (var j = this.nPointsY; --j >= 0; ) for (var k = this.nPointsZ; --k >= 0; ) { +vd[i][j][k] = this.voxelData[(i - n[0]) % nx][(j - n[1]) % ny][(k - n[2]) % nz]; +} + + +this.voxelData = vd; +} else { +var n; +n = this.nPointsX - 1; +for (var i = 0; i < this.nPointsY; ++i) for (var j = 0; j < this.nPointsZ; ++j) this.voxelData[n][i][j] = this.voxelData[0][i][j]; + + +n = this.nPointsY - 1; +for (var i = 0; i < this.nPointsX; ++i) for (var j = 0; j < this.nPointsZ; ++j) this.voxelData[i][n][j] = this.voxelData[i][0][j]; + + +n = this.nPointsZ - 1; +for (var i = 0; i < this.nPointsX; ++i) for (var j = 0; j < this.nPointsY; ++j) this.voxelData[i][j][n] = this.voxelData[i][j][0]; + + +}if (isMapData && this.volumeData.hasPlane()) { +this.volumeData.setVoxelMap(); +for (var x = 0; x < this.nPointsX; ++x) { +for (var y = 0; y < this.nPointsY; ++y) { +for (var z = 0; z < this.nPointsZ; ++z) { +var f = this.volumeData.getToPlaneParameter(); +if (this.volumeData.isNearPlane(x, y, z, f)) this.volumeData.setVoxelMapValue(x, y, z, this.voxelData[x][y][z]); +} +} +} +this.voxelData = null; +}this.volumeData.setVoxelDataAsArray(this.voxelData); +if (this.dataMin > this.params.cutoff) this.params.cutoff = 2 * this.dataMin; +}, "~B"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PltFormattedReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PltFormattedReader.js new file mode 100755 index 000000000000..b1db471fef75 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PltFormattedReader.js @@ -0,0 +1,40 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.VolumeFileReader"], "J.jvxl.readers.PltFormattedReader", ["JU.SB", "JV.Viewer"], function(){ +var c$ = Clazz.declareType(J.jvxl.readers, "PltFormattedReader", J.jvxl.readers.VolumeFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.PltFormattedReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2VFR(sg, br); +this.isAngstroms = true; +this.jvxlData.wasCubic = true; +this.jvxlFileHeaderBuffer = new JU.SB(); +this.nSurfaces = 1; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +var n1 = this.parseIntStr(this.rd()); +var n2 = this.parseInt(); +this.nPointsX = this.parseIntStr(this.rd()); +this.nPointsY = this.parseInt(); +this.nPointsZ = this.parseInt(); +this.jvxlFileHeaderBuffer.append("Plt formatted data (" + n1 + "," + n2 + ") " + this.nPointsX + " x " + this.nPointsY + " x " + this.nPointsZ + " \nJmol " + JV.Viewer.getJmolVersion() + '\n'); +this.volumetricOrigin.set(0, 0, 0); +var xmin = this.parseFloatStr(this.rd().substring(0, 12)); +var xmax = this.parseFloatRange(this.line, 12, 24); +var ymin = this.parseFloatRange(this.line, 24, 36); +var ymax = this.parseFloatRange(this.line, 36, 48); +var zmin = this.parseFloatRange(this.line, 48, 60); +var zmax = this.parseFloatRange(this.line, 60, 72); +this.volumetricOrigin.set(xmin, ymin, zmin); +this.voxelCounts[0] = this.nPointsX; +this.voxelCounts[1] = this.nPointsY; +this.voxelCounts[2] = this.nPointsZ; +this.volumetricVectors[0].set(0, 0, (xmax - xmin) / this.nPointsX); +this.volumetricVectors[1].set(0, (ymax - ymin) / this.nPointsY, 0); +this.volumetricVectors[2].set((zmax - zmin) / this.nPointsZ, 0, 0); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/Pmesh4Reader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/Pmesh4Reader.js new file mode 100755 index 000000000000..4e3b68b015b2 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/Pmesh4Reader.js @@ -0,0 +1,102 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.PolygonFileReader"], "J.jvxl.readers.Pmesh4Reader", ["JU.CU", "$.P4", "J.jvxl.data.JvxlCoder", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.nPolygons = 0; +this.pmeshError = null; +this.type = null; +this.color = 0; +this.transparency = 0; +this.nX = 0; +this.nY = 0; +this.tokens = null; +this.iToken = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "Pmesh4Reader", J.jvxl.readers.PolygonFileReader); +Clazz.prepareFields (c$, function(){ +this.tokens = new Array(0); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.Pmesh4Reader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2PFR(sg, br); +var fileName = (sg.getReaderData())[0]; +if (fileName == null) return; +this.params.fullyLit = true; +this.type = "pmesh4"; +this.jvxlFileHeaderBuffer.append(this.type + " file format\nvertices and triangles only\n"); +J.jvxl.data.JvxlCoder.jvxlCreateHeaderWithoutTitleOrAtoms(this.volumeData, this.jvxlFileHeaderBuffer); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "getSurfaceData", +function(){ +this.rd(); +if (this.readVerticesAndPolygons()) JU.Logger.info(this.type + " file contains " + this.nVertices + " 4D vertices and " + this.nPolygons + " polygons for " + this.nTriangles + " triangles"); + else JU.Logger.error(this.params.fileName + ": " + (this.pmeshError == null ? "Error reading pmesh4 data " : this.pmeshError)); +}); +Clazz.defineMethod(c$, "readVerticesAndPolygons", +function(){ +try { +this.readColor(); +this.nY = this.getInt(); +this.nX = this.getInt(); +this.readVertices(); +this.createMesh(); +return true; +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +if (this.pmeshError == null) this.pmeshError = this.type + " ERROR: " + e; +} else { +throw e; +} +} +return false; +}); +Clazz.defineMethod(c$, "readColor", +function(){ +this.color = JU.CU.colorTriadToFFRGB(this.getFloat(), this.getFloat(), this.getFloat()); +this.transparency = this.getFloat(); +}); +Clazz.defineMethod(c$, "readVertices", +function(){ +this.nVertices = this.nX * this.nY; +this.iToken = 2147483647; +this.pmeshError = this.type + " ERROR: invalid vertex list"; +for (var i = 0; i < this.nVertices; i++) { +var pt = JU.P4.new4(this.getFloat(), this.getFloat(), this.getFloat(), this.getFloat()); +if (JU.Logger.debugging) JU.Logger.debug(i + ": " + pt); +this.addVertexCopy(pt, 0, i, false); +this.iToken = 2147483647; +} +this.pmeshError = null; +return true; +}); +Clazz.defineMethod(c$, "createMesh", +function(){ +for (var i = 0; i < this.nX - 1; i++) { +for (var j = 0; j < this.nY - 1; j++) { +this.nTriangles += 2; +this.addTriangleCheck(i * this.nY + j, (i + 1) * this.nY + j, (i + 1) * this.nY + j + 1, 3, 0, false, this.color); +this.addTriangleCheck((i + 1) * this.nY + j + 1, i * this.nY + j + 1, i * this.nY + j, 3, 0, false, this.color); +} +} +}); +Clazz.defineMethod(c$, "nextToken", +function(){ +while (this.iToken >= this.tokens.length) { +this.iToken = 0; +this.rd(); +this.tokens = this.getTokens(); +} +return this.tokens[this.iToken++]; +}); +Clazz.defineMethod(c$, "getInt", +function(){ +return this.parseIntStr(this.nextToken()); +}); +Clazz.defineMethod(c$, "getFloat", +function(){ +return this.parseFloatStr(this.nextToken()); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PmeshReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PmeshReader.js new file mode 100755 index 000000000000..f8067324569b --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PmeshReader.js @@ -0,0 +1,205 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.PolygonFileReader"], "J.jvxl.readers.PmeshReader", ["JU.CU", "$.P3", "$.PT", "J.jvxl.data.JvxlCoder", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.isBinary = false; +this.nPolygons = 0; +this.pmeshError = null; +this.type = null; +this.isClosedFace = false; +this.fixedCount = 0; +this.onePerLine = false; +this.vertexBase = 0; +this.vertexMap = null; +this.tokens = null; +this.iToken = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "PmeshReader", J.jvxl.readers.PolygonFileReader); +Clazz.prepareFields (c$, function(){ +this.tokens = new Array(0); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.PmeshReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2PR(sg, br); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.defineMethod(c$, "init2PR", +function(sg, br){ +this.init2PFR(sg, br); +var fileName = (sg.getReaderData())[0]; +if (fileName == null) return; +this.type = "pmesh"; +this.setHeader(); +this.isBinary = this.checkBinary(fileName); +this.isClosedFace = !this.isBinary; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.defineMethod(c$, "setHeader", +function(){ +this.jvxlFileHeaderBuffer.append(this.type + " file format\nvertices and triangles only\n"); +J.jvxl.data.JvxlCoder.jvxlCreateHeaderWithoutTitleOrAtoms(this.volumeData, this.jvxlFileHeaderBuffer); +}); +Clazz.defineMethod(c$, "checkBinary", +function(fileName){ +try { +this.br.mark(4); +var buf = Clazz.newCharArray (5, '\0'); +this.br.read(buf, 0, 5); +if (( String.instantialize(buf)).startsWith("PM\u0001\u0000")) { +this.br.close(); +this.binarydoc = this.newBinaryDocument(); +this.setStream(fileName, (buf[4] == '\0')); +return true; +}this.br.reset(); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +System.out.println(e); +} else { +throw e; +} +} +return false; +}, "~S"); +Clazz.overrideMethod(c$, "getSurfaceData", +function(){ +if (this.readVerticesAndPolygons()) JU.Logger.info((this.isBinary ? "binary " : "") + this.type + " file contains " + this.nVertices + " vertices and " + this.nPolygons + " polygons for " + this.nTriangles + " triangles"); + else JU.Logger.error(this.params.fileName + ": " + (this.pmeshError == null ? "Error reading pmesh data " : this.pmeshError)); +}); +Clazz.defineMethod(c$, "readVerticesAndPolygons", +function(){ +try { +if (this.isBinary && !this.readBinaryHeader()) return false; +if (this.readVertices() && this.readPolygons()) return true; +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +if (this.pmeshError == null) this.pmeshError = this.type + " ERROR: " + e; +} else { +throw e; +} +} +return false; +}); +Clazz.defineMethod(c$, "readBinaryHeader", +function(){ +this.pmeshError = "could not read binary Pmesh file header"; +try { +var ignored = Clazz.newByteArray (64, 0); +this.binarydoc.readByteArray(ignored, 0, 8); +this.nVertices = this.binarydoc.readInt(); +this.nPolygons = this.binarydoc.readInt(); +this.binarydoc.readByteArray(ignored, 0, 64); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +this.pmeshError += " " + e.toString(); +this.binarydoc.close(); +return false; +} else { +throw e; +} +} +this.pmeshError = null; +return true; +}); +Clazz.defineMethod(c$, "readVertices", +function(){ +return this.readVerticesPM(); +}); +Clazz.defineMethod(c$, "readVerticesPM", +function(){ +this.pmeshError = this.type + " ERROR: vertex count must be positive"; +if (!this.isBinary) { +this.nVertices = this.getInt(); +if (this.nVertices == -2147483648) this.nVertices = this.getInt(); +}if (this.onePerLine) this.iToken = 2147483647; +if (this.nVertices <= 0) { +this.pmeshError += " (" + this.nVertices + ")"; +return false; +}this.pmeshError = this.type + " ERROR: invalid vertex list"; +this.vertexMap = Clazz.newIntArray (this.nVertices, 0); +for (var i = 0; i < this.nVertices; i++) { +var pt = JU.P3.new3(this.getFloat(), this.getFloat(), this.getFloat()); +if (this.isAnisotropic) this.setVertexAnisotropy(pt); +if (JU.Logger.debugging) JU.Logger.debug(i + ": " + pt); +this.vertexMap[i] = this.addVertexCopy(pt, 0, i, false); +if (this.onePerLine) this.iToken = 2147483647; +} +this.pmeshError = null; +return true; +}); +Clazz.defineMethod(c$, "readPolygons", +function(){ +return this.readPolygonsPM(); +}); +Clazz.defineMethod(c$, "readPolygonsPM", +function(){ +this.pmeshError = this.type + " ERROR: polygon count must be zero or positive"; +if (!this.isBinary) this.nPolygons = this.getInt(); +if (this.onePerLine) this.iToken = 2147483647; +var vertices = Clazz.newIntArray (5, 0); +if (this.nPolygons == -1) this.nPolygons = 2147483647; +var nread = 0; +for (var iPoly = 0; iPoly < this.nPolygons; iPoly++) { +var intCount = (this.fixedCount == 0 ? this.getInt() : this.fixedCount); +if (intCount == 0) break; +nread++; +var haveColor = (intCount < 0); +if (haveColor) intCount = -intCount; +var vertexCount = intCount - (intCount > 3 && this.isClosedFace ? 1 : 0); +if (vertexCount < 1 || vertexCount > 4) { +this.pmeshError = this.type + " ERROR: bad polygon (must have 1-4 vertices) at #" + (iPoly + 1); +return false; +}var isOK = true; +for (var i = 0; i < intCount; ++i) { +if ((vertices[i] = this.getInt() - this.vertexBase) < 0 || vertices[i] >= this.nVertices) { +this.pmeshError = this.type + " ERROR: invalid vertex index: " + vertices[i]; +return false; +}if ((vertices[i] = this.vertexMap[vertices[i]]) < 0) isOK = false; +} +if (this.onePerLine) this.iToken = 2147483647; +if (!isOK) continue; +if (vertexCount < 3) for (var i = vertexCount; i < 3; ++i) vertices[i] = vertices[i - 1]; + +var color = 0; +if (haveColor) { +if (this.isBinary) { +color = this.getInt(); +} else { +var c = this.nextToken(); +try { +color = (c.startsWith("0x") ? JU.PT.parseIntRadix(c.substring(2), 16) : this.parseIntStr(c)); +} catch (e) { +color = -2147483648; +} +if (color == -2147483648) color = JU.CU.getArgbFromString(c); +}color |= 0xFF000000; +}if (vertexCount == 4) { +this.nTriangles += 2; +this.addTriangleCheck(vertices[0], vertices[1], vertices[3], 5, 0, false, color); +this.addTriangleCheck(vertices[1], vertices[2], vertices[3], 3, 0, false, color); +} else { +this.nTriangles++; +this.addTriangleCheck(vertices[0], vertices[1], vertices[2], 7, 0, false, color); +}} +if (this.isBinary) this.nBytes = this.binarydoc.getPosition(); +this.nPolygons = nread; +return true; +}); +Clazz.defineMethod(c$, "nextToken", +function(){ +while (this.iToken >= this.tokens.length) { +this.iToken = 0; +this.rd(); +this.tokens = this.getTokens(); +} +return this.tokens[this.iToken++]; +}); +Clazz.defineMethod(c$, "getInt", +function(){ +return (this.isBinary ? this.binarydoc.readInt() : this.parseIntStr(this.nextToken())); +}); +Clazz.defineMethod(c$, "getFloat", +function(){ +return (this.isBinary ? this.binarydoc.readFloat() : this.parseFloatStr(this.nextToken())); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PolygonFileReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PolygonFileReader.js new file mode 100755 index 000000000000..0b408295fc68 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PolygonFileReader.js @@ -0,0 +1,31 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.SurfaceFileReader"], "J.jvxl.readers.PolygonFileReader", ["java.util.Date", "JU.SB"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.nVertices = 0; +this.nTriangles = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "PolygonFileReader", J.jvxl.readers.SurfaceFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.PolygonFileReader, []); +}); +Clazz.defineMethod(c$, "init2PFR", +function(sg, br){ +this.init2SFR(sg, br); +this.jvxlFileHeaderBuffer = new JU.SB(); +this.jvxlFileHeaderBuffer.append("#created ").append("" + new java.util.Date()).append("\n"); +this.vertexDataOnly = true; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readVolumeParameters", +function(isMapData){ +return true; +}, "~B"); +Clazz.overrideMethod(c$, "readVolumeData", +function(isMapData){ +return true; +}, "~B"); +Clazz.overrideMethod(c$, "readSurfaceData", +function(isMapData){ +this.getSurfaceData(); +}, "~B"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PyMOLMeshReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PyMOLMeshReader.js new file mode 100755 index 000000000000..2ca1e15f6633 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/PyMOLMeshReader.js @@ -0,0 +1,127 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.MapFileReader"], "J.jvxl.readers.PyMOLMeshReader", ["JU.SB", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.data = null; +this.voxelList = null; +this.surfaceName = null; +this.pymolType = 0; +this.isMesh = false; +this.pt = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "PyMOLMeshReader", J.jvxl.readers.MapFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.PyMOLMeshReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, brNull){ +this.init2MFR(sg, null); +this.allowSigma = true; +this.nSurfaces = 1; +var map = sg.getReaderData(); +this.data = map.get(this.params.calculationType); +if (this.data == null) return; +this.pymolType = Clazz.floatToInt(this.getFloat(J.jvxl.readers.PyMOLMeshReader.getList(this.data, 0), 0)); +this.isMesh = (this.pymolType == 3); +this.surfaceName = this.data.get(this.data.size() - 1); +JU.Logger.info("PyMOLMeshReader for " + this.params.calculationType + " pymolType=" + this.pymolType + "; isMesh=" + this.isMesh + " surfaceName=" + this.surfaceName); +this.data = J.jvxl.readers.PyMOLMeshReader.getList(J.jvxl.readers.PyMOLMeshReader.getList(this.data, 2), 0); +if (this.isMesh && this.params.thePlane == null && this.params.cutoffAutomatic) { +this.params.cutoff = this.getFloat(this.data, 8); +this.params.cutoffAutomatic = false; +}if (this.isMesh) this.data = J.jvxl.readers.PyMOLMeshReader.getList(J.jvxl.readers.PyMOLMeshReader.getList(map.get(this.surfaceName), 2), 0); +this.voxelList = J.jvxl.readers.PyMOLMeshReader.getList(J.jvxl.readers.PyMOLMeshReader.getList(J.jvxl.readers.PyMOLMeshReader.getList(this.data, 14), 2), 6); +JU.Logger.info("PyMOLMeshReader: Number of grid points = " + this.voxelList.size()); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +c$.getList = Clazz.defineMethod(c$, "getList", +function(list, i){ +return list.get(i); +}, "JU.Lst,~N"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +var t; +this.jvxlFileHeaderBuffer = new JU.SB(); +this.jvxlFileHeaderBuffer.append("PyMOL surface reader\n"); +this.jvxlFileHeaderBuffer.append(this.surfaceName + " (" + this.params.calculationType + ")\n"); +var s = J.jvxl.readers.PyMOLMeshReader.getList(this.data, 1); +t = J.jvxl.readers.PyMOLMeshReader.getList(s, 0); +var haveUnitCell = false; +if (t != null) { +if (t.size() < 3) t = J.jvxl.readers.PyMOLMeshReader.getList(s = J.jvxl.readers.PyMOLMeshReader.getList(s, 0), 0); +this.a = this.getFloat(t, 0); +haveUnitCell = (this.a != 1); +if (haveUnitCell) { +this.b = this.getFloat(t, 1); +this.c = this.getFloat(t, 2); +t = J.jvxl.readers.PyMOLMeshReader.getList(s, 1); +this.alpha = this.getFloat(t, 0); +this.beta = this.getFloat(t, 1); +this.gamma = this.getFloat(t, 2); +}}t = J.jvxl.readers.PyMOLMeshReader.getList(this.data, 7); +this.origin.set(this.getFloat(t, 0), this.getFloat(t, 1), this.getFloat(t, 2)); +t = J.jvxl.readers.PyMOLMeshReader.getList(this.data, 10); +this.na = Clazz.floatToInt(this.getFloat(t, 0)); +this.nb = Clazz.floatToInt(this.getFloat(t, 1)); +this.nc = Clazz.floatToInt(this.getFloat(t, 2)); +t = J.jvxl.readers.PyMOLMeshReader.getList(this.data, 11); +this.xyzStart[0] = this.getFloat(t, 0); +this.xyzStart[1] = this.getFloat(t, 1); +this.xyzStart[2] = this.getFloat(t, 2); +t = J.jvxl.readers.PyMOLMeshReader.getList(this.data, 13); +this.n2 = Clazz.floatToInt(this.getFloat(t, 0)); +this.n1 = Clazz.floatToInt(this.getFloat(t, 1)); +this.n0 = Clazz.floatToInt(this.getFloat(t, 2)); +if (!haveUnitCell) { +this.na = this.n2 - 1; +this.nb = this.n1 - 1; +this.nc = this.n0 - 1; +t = J.jvxl.readers.PyMOLMeshReader.getList(this.data, 8); +this.a = this.getFloat(t, 0) - this.origin.x; +this.b = this.getFloat(t, 1) - this.origin.y; +this.c = this.getFloat(t, 2) - this.origin.z; +this.alpha = this.beta = this.gamma = 90; +}this.mapc = 3; +this.mapr = 2; +this.maps = 1; +this.getVectorsAndOrigin(); +this.setCutoffAutomatic(); +}); +Clazz.overrideMethod(c$, "nextVoxel", +function(){ +return this.getFloat(this.voxelList, this.pt++); +}); +Clazz.defineMethod(c$, "getFloat", +function(list, i){ +return (list.get(i)).floatValue(); +}, "JU.Lst,~N"); +Clazz.overrideMethod(c$, "skipData", +function(nPoints){ +}, "~N"); +Clazz.overrideMethod(c$, "setCutoffAutomatic", +function(){ +if (this.params.thePlane != null) return; +if (Float.isNaN(this.params.sigma)) { +if (!this.params.cutoffAutomatic) return; +this.params.cutoff = (this.boundingBox == null ? 3.0 : 1.6); +if (this.dmin != 3.4028235E38) { +if (this.params.cutoff > this.dmax) this.params.cutoff = this.dmax / 4; +}} else { +this.params.cutoff = this.calculateCutoff(); +}JU.Logger.info("MapReader: setting cutoff to default value of " + this.params.cutoff + (this.boundingBox == null ? " (no BOUNDBOX parameter)\n" : "\n")); +}); +Clazz.defineMethod(c$, "calculateCutoff", +function(){ +var n = this.voxelList.size(); +var sum = 0; +var sum2 = 0; +for (var i = 0; i < n; i++) { +var v = this.getFloat(this.voxelList, i); +sum += v; +sum2 += v * v; +} +var mean = sum / n; +var rmsd = Math.sqrt(sum2 / n); +JU.Logger.info("PyMOLMeshReader rmsd=" + rmsd + " mean=" + mean); +return this.params.sigma * rmsd + mean; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/Ras3DReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/Ras3DReader.js new file mode 100755 index 000000000000..c5b266743214 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/Ras3DReader.js @@ -0,0 +1,97 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.PolygonFileReader"], "J.jvxl.readers.Ras3DReader", ["java.util.Hashtable", "JU.CU", "$.P3", "J.jvxl.data.JvxlCoder", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.pmeshError = null; +this.type = null; +this.asQuads = false; +this.nPolygons = 0; +this.htVertices = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "Ras3DReader", J.jvxl.readers.PolygonFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.Ras3DReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2PR(sg, br); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.defineMethod(c$, "init2PR", +function(sg, br){ +this.init2PFR(sg, br); +var fileName = (sg.getReaderData())[0]; +if (fileName == null) return; +this.type = "ras3d"; +this.setHeader(); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.defineMethod(c$, "setHeader", +function(){ +this.jvxlFileHeaderBuffer.append(this.type + " file format\nvertices and triangles only\n"); +J.jvxl.data.JvxlCoder.jvxlCreateHeaderWithoutTitleOrAtoms(this.volumeData, this.jvxlFileHeaderBuffer); +}); +Clazz.overrideMethod(c$, "getSurfaceData", +function(){ +if (this.readVerticesAndPolygons()) JU.Logger.info(this.type + " file contains " + this.nVertices + " vertices and " + this.nPolygons + " polygons for " + this.nTriangles + " triangles"); + else JU.Logger.error(this.params.fileName + ": " + (this.pmeshError == null ? "Error reading pmesh data " : this.pmeshError)); +}); +Clazz.defineMethod(c$, "readVerticesAndPolygons", +function(){ +try { +if (this.readVertices()) return true; +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +if (this.pmeshError == null) this.pmeshError = this.type + " ERROR: " + e; +} else { +throw e; +} +} +return false; +}); +Clazz.defineMethod(c$, "readVertices", +function(){ +this.htVertices = new java.util.Hashtable(); +var v0 = Clazz.newIntArray (3, 0); +var v1 = Clazz.newIntArray (3, 0); +var v2; +var c0 = 0; +var c1 = 0; +var c2; +if (this.rd().indexOf("DSSR") >= 0) this.asQuads = true; +while (this.rd() != null) { +while (!this.line.equals("1")) { +this.rd(); +} +this.rd(); +var tokens = this.getTokens(); +v0[0] = this.getPoint(tokens, 0); +v0[1] = this.getPoint(tokens, 3); +v0[2] = this.getPoint(tokens, 6); +this.nTriangles++; +c0 = JU.CU.colorTriadToFFRGB(this.parseFloatStr(tokens[9]), this.parseFloatStr(tokens[10]), this.parseFloatStr(tokens[11])); +if (this.asQuads) { +if (this.nTriangles % 2 == 1) { +v2 = v1; +v1 = v0; +v0 = v2; +c2 = c1; +c1 = c0; +c0 = c2; +continue; +}this.addTriangleCheck(v0[0], v0[1], v0[2], 6, 0, false, c0); +this.addTriangleCheck(v1[0], v1[1], v1[2], 3, 0, false, c1); +} else { +this.addTriangleCheck(v0[0], v0[1], v0[2], 7, 0, false, c0); +}this.nPolygons++; +} +return true; +}); +Clazz.defineMethod(c$, "getPoint", +function(tokens, i){ +var key = tokens[i] + ";" + tokens[i + 1] + ";" + tokens[i + 2]; +var v = this.htVertices.get(key); +if (v == null) { +this.addVertexCopy(JU.P3.new3(this.parseFloatStr(tokens[i]), this.parseFloatStr(tokens[i + 1]), this.parseFloatStr(tokens[i + 2])), 0, this.nVertices, false); +this.htVertices.put(key, v = Integer.$valueOf(this.nVertices++)); +}return v.intValue(); +}, "~A,~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/SurfaceFileReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/SurfaceFileReader.js new file mode 100755 index 000000000000..46d6ef833c96 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/SurfaceFileReader.js @@ -0,0 +1,140 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.SurfaceReader"], "J.jvxl.readers.SurfaceFileReader", ["JU.PT", "$.Rdr", "J.api.Interface"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.br = null; +this.binarydoc = null; +this.out = null; +this.line = null; +this.next = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "SurfaceFileReader", J.jvxl.readers.SurfaceReader); +Clazz.prepareFields (c$, function(){ +this.next = Clazz.newIntArray (1, 0); +}); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.SurfaceFileReader, []); +}); +Clazz.defineMethod(c$, "setStream", +function(fileName, isBigEndian){ +if (fileName == null) this.binarydoc.setStream(null, isBigEndian); + else try { +if (Clazz.instanceOf(this.br,"JU.Rdr.StreamReader")) { +var stream = (this.br).getStream(); +stream.reset(); +this.binarydoc.setStream(stream, true); +}} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +System.out.println("BCifDensityReader " + e); +this.binarydoc.setStream(this.sg.atomDataServer.getBufferedInputStream(fileName), isBigEndian); +} else { +throw e; +} +} +}, "~S,~B"); +Clazz.overrideMethod(c$, "init", +function(sg){ +this.initSR(sg); +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.defineMethod(c$, "init2", +function(sg, br){ +this.init2SFR(sg, br); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.defineMethod(c$, "init2SFR", +function(sg, br){ +this.br = br; +this.init(sg); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.defineMethod(c$, "newBinaryDocument", +function(){ +return J.api.Interface.getInterface("JU.BinaryDocument", this.sg.atomDataServer, "file"); +}); +Clazz.overrideMethod(c$, "setOutputChannel", +function(out){ +if (this.binarydoc == null) this.out = out; + else this.sg.setOutputChannel(this.binarydoc, out); +}, "JU.OC"); +Clazz.overrideMethod(c$, "closeReader", +function(){ +this.closeReaderSFR(); +}); +Clazz.defineMethod(c$, "closeReaderSFR", +function(){ +if (this.br != null) try { +this.br.close(); +} catch (e) { +if (Clazz.exceptionOf(e,"java.io.IOException")){ +} else { +throw e; +} +} +if (this.out != null) this.out.closeChannel(); +if (this.binarydoc != null) this.binarydoc.close(); +}); +Clazz.overrideMethod(c$, "discardTempData", +function(discardAll){ +this.closeReader(); +this.discardTempDataSR(discardAll); +}, "~B"); +Clazz.defineMethod(c$, "getTokens", +function(){ +return JU.PT.getTokensAt(this.line, 0); +}); +Clazz.defineMethod(c$, "parseFloat", +function(){ +return JU.PT.parseFloatNext(this.line, this.next); +}); +Clazz.defineMethod(c$, "parseFloatStr", +function(s){ +this.next[0] = 0; +return JU.PT.parseFloatNext(s, this.next); +}, "~S"); +Clazz.defineMethod(c$, "parseFloatRange", +function(s, iStart, iEnd){ +this.next[0] = iStart; +return JU.PT.parseFloatRange(s, iEnd, this.next); +}, "~S,~N,~N"); +Clazz.defineMethod(c$, "parseInt", +function(){ +return JU.PT.parseIntNext(this.line, this.next); +}); +Clazz.defineMethod(c$, "parseIntStr", +function(s){ +this.next[0] = 0; +return JU.PT.parseIntNext(s, this.next); +}, "~S"); +Clazz.defineMethod(c$, "parseIntNext", +function(s){ +return JU.PT.parseIntNext(s, this.next); +}, "~S"); +Clazz.defineMethod(c$, "parseFloatArrayStr", +function(s){ +this.next[0] = 0; +return JU.PT.parseFloatArrayNext(s, this.next, null, null, null); +}, "~S"); +Clazz.defineMethod(c$, "parseFloatArray", +function(a, strStart, strEnd){ +return JU.PT.parseFloatArrayNext(this.line, this.next, a, strStart, strEnd); +}, "~A,~S,~S"); +Clazz.defineMethod(c$, "getQuotedStringNext", +function(){ +return JU.PT.getQuotedStringNext(this.line, this.next); +}); +Clazz.defineMethod(c$, "skipTo", +function(info, what){ +if (info != null) while (this.rd().indexOf(info) < 0) { +} +if (what != null) this.next[0] = this.line.indexOf(what) + what.length + 2; +}, "~S,~S"); +Clazz.defineMethod(c$, "rd", +function(){ +this.line = this.br.readLine(); +if (this.line != null) { +this.nBytes += this.line.length; +if (this.out != null) { +var b = this.line.getBytes(); +this.out.write(b, 0, b.length); +this.out.writeByteAsInt(0x0A); +}}return this.line; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/SurfaceGenerator.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/SurfaceGenerator.js new file mode 100755 index 000000000000..a9baf010d6ed --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/SurfaceGenerator.js @@ -0,0 +1,866 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["JU.P3", "$.V3"], "J.jvxl.readers.SurfaceGenerator", ["JU.AU", "$.BS", "$.Measure", "$.P4", "$.PT", "$.Rdr", "$.SB", "J.jvxl.data.JvxlCoder", "$.JvxlData", "$.MeshData", "$.VolumeData", "J.jvxl.readers.Parameters", "$.SurfaceReader", "JU.Logger", "JV.FileManager"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.params = null; +this.jvxlData = null; +this.meshData = null; +this.volumeDataTemp = null; +this.meshDataServer = null; +this.atomDataServer = null; +this.marchingSquares = null; +this.version = null; +this.isValid = true; +this.fileType = null; +this.bsVdw = null; +this.colorPtr = 0; +this.surfaceReader = null; +this.out = null; +this.readerData = null; +this.vAB = null; +this.vNorm = null; +this.ptRef = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "SurfaceGenerator", null); +Clazz.prepareFields (c$, function(){ +this.vAB = new JU.V3(); +this.vNorm = new JU.V3(); +this.ptRef = JU.P3.new3(0, 0, 1e15); +}); +Clazz.makeConstructor(c$, +function(atomDataServer, meshDataServer, meshData, jvxlData){ +this.atomDataServer = atomDataServer; +this.meshDataServer = meshDataServer; +this.params = new J.jvxl.readers.Parameters(); +this.meshData = (meshData == null ? new J.jvxl.data.MeshData() : meshData); +this.jvxlData = (jvxlData == null ? new J.jvxl.data.JvxlData() : jvxlData); +this.volumeDataTemp = new J.jvxl.data.VolumeData(); +this.initializeIsosurface(); +}, "J.atomdata.AtomDataServer,J.jvxl.api.MeshDataServer,J.jvxl.data.MeshData,J.jvxl.data.JvxlData"); +Clazz.defineMethod(c$, "setJvxlData", +function(jvxlData){ +this.jvxlData = jvxlData; +if (jvxlData != null) jvxlData.version = this.version; +}, "J.jvxl.data.JvxlData"); +Clazz.defineMethod(c$, "setProp", +function(propertyName, value, bs){ +if ("debug" === propertyName) { +var TF = (value).booleanValue(); +this.params.logMessages = TF; +this.params.logCube = TF; +return true; +}if ("init" === propertyName) { +this.initializeIsosurface(); +if (Clazz.instanceOf(value,"J.jvxl.readers.Parameters")) { +this.params = value; +} else { +this.params.script = value; +if (this.params.script != null && this.params.script.indexOf(";#") >= 0) { +this.params.script = JU.PT.rep(this.params.script, ";#", "; #"); +}}return false; +}if ("silent" === propertyName) { +this.params.isSilent = true; +return true; +}if ("map" === propertyName) { +this.params.resetForMapping((value).booleanValue()); +if (this.surfaceReader != null) this.surfaceReader.minMax = null; +return true; +}if ("finalize" === propertyName) { +this.initializeIsosurface(); +return true; +}if ("clear" === propertyName) { +if (this.surfaceReader != null) this.surfaceReader.discardTempData(true); +return false; +}if ("fileIndex" === propertyName) { +this.params.fileIndex = (value).intValue(); +if (this.params.fileIndex < 0) this.params.fileIndex = 0; +this.params.readAllData = false; +return true; +}if ("blockData" === propertyName) { +this.params.blockCubeData = (value).booleanValue(); +return true; +}if ("withinPoints" === propertyName) { +this.params.boundingBox = (value)[1]; +return true; +}if ("boundingBox" === propertyName) { +var pts = value; +this.params.boundingBox = Clazz.newArray(-1, [JU.P3.newP(pts[0]), JU.P3.newP(pts[pts.length - 1])]); +return true; +}if ("func" === propertyName) { +this.params.func = value; +return true; +}if ("intersection" === propertyName) { +this.params.intersection = value; +return true; +}if ("bsSolvent" === propertyName) { +this.params.bsSolvent = value; +return true; +}if ("select" === propertyName) { +this.params.bsSelected = value; +return true; +}if ("ignore" === propertyName) { +this.params.bsIgnore = value; +return true; +}if ("propertySmoothing" === propertyName) { +this.params.propertySmoothing = (value).booleanValue(); +return true; +}if ("propertyDistanceMax" === propertyName) { +this.params.propertyDistanceMax = (value).floatValue(); +return true; +}if ("propertySmoothingPower" === propertyName) { +this.params.propertySmoothingPower = (value).intValue(); +return true; +}if ("title" === propertyName) { +if (value == null) { +this.params.title = null; +return true; +} else if (JU.AU.isAS(value)) { +this.params.title = value; +if (JU.Logger.debugging) for (var i = 0; i < this.params.title.length; i++) if (this.params.title[i].length > 0) JU.Logger.info(this.params.title[i]); + +}return true; +}if ("sigma" === propertyName) { +this.params.cutoff = this.params.sigma = (value).floatValue(); +this.params.cutoffRange = null; +this.params.cutoffAutomatic = false; +return true; +}if ("cutoff" === propertyName) { +this.params.cutoff = (value).floatValue(); +this.params.cutoffRange = null; +this.params.isPositiveOnly = false; +this.params.cutoffAutomatic = false; +return true; +}if ("cutoffPositive" === propertyName) { +this.params.cutoff = (value).floatValue(); +this.params.cutoffRange = null; +this.params.isPositiveOnly = true; +this.params.isCutoffAbsolute = false; +this.params.cutoffAutomatic = false; +return true; +}if ("cutoffRange" === propertyName) { +this.params.cutoffRange = value; +this.params.cutoff = this.params.cutoffRange[0]; +this.params.isPositiveOnly = false; +this.params.cutoffAutomatic = false; +return true; +}if ("parameters" === propertyName) { +this.params.parameters = JU.AU.ensureLengthA(value, 2); +if (this.params.parameters.length > 0 && this.params.parameters[0] != 0) this.params.cutoff = this.params.parameters[0]; +return true; +}if ("cap" === propertyName || "slab" === propertyName) { +if (value != null) this.params.addSlabInfo(value); +return true; +}if ("scale" === propertyName) { +this.params.scale = (value).floatValue(); +return true; +}if ("scale3d" === propertyName) { +this.params.scale3d = (value).floatValue(); +return true; +}if ("angstroms" === propertyName) { +this.params.isAngstroms = true; +return true; +}if ("resolution" === propertyName) { +var resolution = (value).floatValue(); +this.params.resolution = (resolution > 0 ? resolution : 3.4028235E38); +return true; +}if ("downsample" === propertyName) { +var rate = (value).intValue(); +this.params.downsampleFactor = (rate >= 0 ? rate : 0); +return true; +}if ("anisotropy" === propertyName) { +if ((this.params.dataType & 32) == 0) this.params.setAnisotropy(value); +return true; +}if ("eccentricity" === propertyName) { +this.params.setEccentricity(value); +return true; +}if ("addHydrogens" === propertyName) { +this.params.addHydrogens = (value).booleanValue(); +return true; +}if ("squareData" === propertyName) { +this.params.isSquared = (value == null ? false : (value).booleanValue()); +return true; +}if ("squareLinear" === propertyName) { +this.params.isSquaredLinear = (value == null ? false : (value).booleanValue()); +return true; +}if ("gridPoints" === propertyName) { +this.params.iAddGridPoints = true; +return true; +}if ("atomIndex" === propertyName) { +this.params.atomIndex = (value).intValue(); +return true; +}if ("insideOut" === propertyName) { +this.params.insideOut = true; +return true; +}if ("sign" === propertyName) { +this.params.isCutoffAbsolute = !this.params.isPositiveOnly; +this.params.colorBySign = true; +this.colorPtr = 0; +return true; +}if ("colorRGB" === propertyName) { +var rgb = (value).intValue(); +this.params.colorRgb = this.params.colorPos = this.params.colorPosLCAO = rgb; +if (this.colorPtr++ == 0) { +this.params.colorNeg = this.params.colorNegLCAO = rgb; +} else { +this.params.colorRgb = 2147483647; +}return true; +}if ("monteCarloCount" === propertyName) { +this.params.psi_monteCarloCount = (value).intValue(); +return true; +}if ("rangeAll" === propertyName) { +this.params.rangeAll = true; +return true; +}if ("rangeSelected" === propertyName) { +this.params.rangeSelected = true; +return true; +}if ("red" === propertyName) { +this.params.valueMappedToRed = (value).floatValue(); +return true; +}if ("blue" === propertyName) { +this.params.valueMappedToBlue = (value).floatValue(); +if (this.params.valueMappedToRed > this.params.valueMappedToBlue) { +var f = this.params.valueMappedToRed; +this.params.valueMappedToRed = this.params.valueMappedToBlue; +this.params.valueMappedToBlue = f; +this.params.isColorReversed = !this.params.isColorReversed; +}this.params.rangeDefined = true; +this.params.rangeAll = false; +return true; +}if ("reverseColor" === propertyName) { +this.params.isColorReversed = true; +return true; +}if ("setColorScheme" === propertyName) { +this.getSurfaceSets(); +this.params.colorBySets = true; +this.mapSurface(); +return true; +}if ("center" === propertyName) { +this.params.center.setT(value); +return true; +}if ("origin" === propertyName) { +this.params.origin = value; +return true; +}if ("step" === propertyName) { +this.params.steps = value; +return true; +}if ("modelInvRotation" === propertyName) { +this.params.modelInvRotation = value; +return true; +}if ("point" === propertyName) { +this.params.points = value; +return true; +}if ("withinDistance" === propertyName) { +this.params.distance = (value).floatValue(); +return true; +}if ("withinPoint" === propertyName) { +this.params.point = value; +return true; +}if ("progressive" === propertyName) { +this.params.isXLowToHigh = true; +return true; +}if ("phase" === propertyName) { +var color = value; +this.params.isCutoffAbsolute = true; +this.params.colorBySign = true; +this.params.colorByPhase = true; +this.params.colorPhase = J.jvxl.readers.SurfaceReader.getColorPhaseIndex(color); +if (this.params.colorPhase < 0) { +JU.Logger.warn(" invalid color phase: " + color); +this.params.colorPhase = 0; +}this.params.colorByPhase = this.params.colorPhase != 0; +if (this.params.state >= 2) { +this.params.dataType = this.params.surfaceType; +this.params.state = 3; +this.params.isBicolorMap = true; +this.surfaceReader.applyColorScale(); +}return true; +}if ("radius" === propertyName) { +JU.Logger.info("solvent probe radius set to " + value); +this.params.atomRadiusData = value; +return true; +}if ("envelopeRadius" === propertyName) { +this.params.envelopeRadius = (value).floatValue(); +return true; +}if ("cavityRadius" === propertyName) { +this.params.cavityRadius = (value).floatValue(); +return true; +}if ("cavity" === propertyName) { +this.params.isCavity = true; +return true; +}if ("doFullMolecular" === propertyName) { +this.params.doFullMolecular = true; +return true; +}if ("pocket" === propertyName) { +this.params.pocket = value; +this.params.fullyLit = this.params.pocket.booleanValue(); +return true; +}if ("minset" === propertyName) { +this.params.minSet = (value).intValue(); +return true; +}if ("maxset" === propertyName) { +this.params.maxSet = (value).intValue(); +return true; +}if ("plane" === propertyName) { +this.params.setPlane(value); +return true; +}if ("contour" === propertyName) { +this.params.isContoured = true; +var n; +if (JU.AU.isAF(value)) { +this.params.contoursDiscrete = value; +this.params.nContours = this.params.contoursDiscrete.length; +} else if (Clazz.instanceOf(value,"JU.P3")) { +var pt = this.params.contourIncrements = value; +var from = pt.x; +var to = pt.y; +var step = pt.z; +if (step <= 0) step = 1; +n = 0; +for (var p = from; p <= to + step / 10; p += step, n++) { +} +this.params.contoursDiscrete = Clazz.newFloatArray (n, 0); +var p = from; +for (var i = 0; i < n; i++, p += step) { +this.params.contoursDiscrete[i] = p; +} +this.params.nContours = n; +} else { +n = (value).intValue(); +this.params.thisContour = 0; +if (n == 0) this.params.nContours = 9; + else if (n > 0) this.params.nContours = n; + else this.params.thisContour = -n; +}return true; +}if ("colorDiscrete" === propertyName) { +this.params.contourColixes = value; +return true; +}if ("colorDensity" === propertyName) { +this.params.colorDensity = true; +if (value != null) this.params.pointSize = (value).floatValue(); +return false; +}if ("fullPlane" === propertyName) { +this.params.contourFromZero = !(value).booleanValue(); +return true; +}if ("mapLattice" === propertyName) { +this.params.mapLattice = value; +return true; +}if ("extendGrid" === propertyName) { +this.params.extendGrid = (value).floatValue(); +return true; +}if ("property" === propertyName) { +this.params.dataType = 1208; +this.params.theProperty = value; +this.mapSurface(); +return true; +}if ("sphere" === propertyName) { +this.params.setSphere((value).floatValue(), false); +this.readerData = Float.$valueOf(this.params.distance); +this.surfaceReader = this.newReader("IsoShapeReader"); +this.generateSurface(); +return true; +}if ("geodesic" === propertyName) { +this.params.setSphere((value).floatValue(), true); +this.readerData = Float.$valueOf(this.params.distance); +this.surfaceReader = this.newReader("IsoShapeReader"); +this.generateSurface(); +return true; +}if ("ellipsoid" === propertyName) { +if (Clazz.instanceOf(value,"JU.P4")) this.params.setEllipsoidP4(value); + else if (JU.AU.isAF(value)) this.params.setEllipsoidAF(value); + else return true; +this.readerData = Float.$valueOf(this.params.distance); +this.surfaceReader = this.newReader("IsoShapeReader"); +this.generateSurface(); +return true; +}if ("ellipsoid3" === propertyName) { +this.params.setEllipsoidAF(value); +this.readerData = Float.$valueOf(this.params.distance); +this.surfaceReader = this.newReader("IsoShapeReader"); +this.generateSurface(); +return true; +}if ("lp" === propertyName) { +this.params.setLp(value); +this.readerData = Clazz.newFloatArray(-1, [3, 2, 0, 15, 0]); +this.surfaceReader = this.newReader("IsoShapeReader"); +this.generateSurface(); +return true; +}if ("rad" === propertyName) { +this.params.setRadical(value); +this.readerData = Clazz.newFloatArray(-1, [3, 2, 0, 15, 0]); +this.surfaceReader = this.newReader("IsoShapeReader"); +this.generateSurface(); +return true; +}if ("lobe" === propertyName) { +this.params.setLobe(value); +this.readerData = Clazz.newFloatArray(-1, [3, 2, 0, 15, 0]); +this.surfaceReader = this.newReader("IsoShapeReader"); +this.generateSurface(); +return true; +}if ("hydrogenOrbital" === propertyName) { +if (!this.params.setAtomicOrbital(value)) { +this.isValid = false; +return true; +}this.readerData = Clazz.newFloatArray(-1, [this.params.psi_n, this.params.psi_l, this.params.psi_m, this.params.psi_Znuc, this.params.psi_monteCarloCount]); +this.surfaceReader = this.newReader("IsoShapeReader"); +this.processState(); +return true; +}if ("functionXY" === propertyName) { +this.params.setFunctionXY(value); +if (this.params.isContoured) this.volumeDataTemp.setPlaneParameters(this.params.thePlane == null ? this.params.thePlane = JU.P4.new4(0, 0, 1, 0) : this.params.thePlane); +if ((this.params.functionInfo.get(0)).indexOf("_xyz") >= 0) this.getFunctionZfromXY(); +this.processState(); +return true; +}if ("functionXYZ" === propertyName) { +this.params.setFunctionXYZ(value); +this.processState(); +return true; +}if ("lcaoType" === propertyName) { +this.params.setLcao(value, this.colorPtr); +return true; +}if ("lcaoCartoonCenter" === propertyName) { +if (++this.params.state != 2) return true; +if (Float.isNaN(this.params.center.x)) this.params.center.setT(value); +return false; +}if ("molecular" === propertyName || "solvent" === propertyName || "sasurface" === propertyName || "nomap" === propertyName) { +this.params.setSolvent(propertyName, (value).floatValue()); +if (!this.params.isSilent) JU.Logger.info(this.params.calculationType); +this.processState(); +return true; +}if ("moData" === propertyName) { +this.params.moData = value; +return true; +}if ("mepCalcType" === propertyName) { +this.params.mep_calcType = (value).intValue(); +return true; +}if ("mep" === propertyName) { +this.params.setMep(value, false); +this.processState(); +return true; +}if ("mlp" === propertyName) { +this.params.setMep(value, true); +this.processState(); +return true; +}if ("nci" === propertyName) { +var isPromolecular = (value).booleanValue(); +this.params.setNci(isPromolecular); +if (isPromolecular) this.processState(); +return true; +}if ("calculationType" === propertyName) { +this.params.calculationType = value; +return true; +}if ("charges" === propertyName) { +this.params.theProperty = value; +return true; +}if ("randomSeed" === propertyName) { +this.params.randomSeed = (value).intValue(); +return true; +}if ("molecularOrbital" === propertyName) { +var iMo = 0; +var linearCombination = null; +if (Clazz.instanceOf(value, Integer)) { +iMo = (value).intValue(); +} else { +linearCombination = value; +}this.params.setMO(iMo, linearCombination); +JU.Logger.info(this.params.calculationType); +this.processState(); +return true; +}if ("fileType" === propertyName) { +this.fileType = value; +return true; +}if ("fileName" === propertyName) { +this.params.fileName = value; +return true; +}if ("filesData" === propertyName) { +this.params.filesData = value; +return true; +}if ("outputChannel" === propertyName) { +this.out = value; +return true; +}if ("readFile" === propertyName) { +if ((this.surfaceReader = this.setFileData(this.atomDataServer, value)) == null) { +JU.Logger.error("Could not set the surface data"); +return true; +}this.surfaceReader.setOutputChannel(this.out); +this.generateSurface(); +return true; +}if ("mapColor" === propertyName) { +if ((this.surfaceReader = this.setFileData(this.atomDataServer, value)) == null) { +JU.Logger.error("Could not set the mapping data"); +return true; +}this.surfaceReader.setOutputChannel(this.out); +this.mapSurface(); +return true; +}if ("getSurfaceSets" === propertyName) { +this.getSurfaceSets(); +return true; +}if ("periodic" === propertyName) { +this.params.isPeriodic = true; +}return false; +}, "~S,~O,JU.BS"); +Clazz.defineMethod(c$, "newReader", +function(name){ +var sr = J.jvxl.readers.SurfaceGenerator.getInterface(name); +if (sr != null) sr.init(this); +return sr; +}, "~S"); +Clazz.defineMethod(c$, "newReaderBr", +function(name, br){ +var sr = J.jvxl.readers.SurfaceGenerator.getInterface(name); +if (sr != null) sr.init2(this, br); +return sr; +}, "~S,java.io.BufferedReader"); +c$.getInterface = Clazz.defineMethod(c$, "getInterface", +function(name){ +try { +var x = Clazz._4Name("J.jvxl.readers." + name); +return (x == null ? null : x.newInstance()); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.error("Interface.java Error creating instance for " + name + ": \n" + e.toString()); +return null; +} else { +throw e; +} +} +}, "~S"); +Clazz.defineMethod(c$, "getSurfaceSets", +function(){ +if (this.meshDataServer == null) { +this.meshData.getSurfaceSet(); +} else { +this.meshDataServer.fillMeshData(this.meshData, 1, null); +this.meshData.getSurfaceSet(); +this.meshDataServer.fillMeshData(this.meshData, 3, null); +}}); +Clazz.defineMethod(c$, "processState", +function(){ +if (this.params.state == 1 && this.params.thePlane != null) this.params.state++; +if (this.params.state >= 2) { +this.mapSurface(); +} else { +this.generateSurface(); +}}); +Clazz.defineMethod(c$, "setReader", +function(){ +this.readerData = null; +if (this.surfaceReader != null) return !this.surfaceReader.vertexDataOnly; +switch (this.params.dataType) { +case 1207: +this.surfaceReader = this.newReader("IsoPlaneReader"); +break; +case 1208: +this.surfaceReader = this.newReader("AtomPropertyMapper"); +break; +case 1328: +case 1329: +this.readerData = (this.params.dataType == 1328 ? "Mep" : "Mlp"); +if (this.params.state == 3) { +this.surfaceReader = this.newReader("AtomPropertyMapper"); +} else { +this.surfaceReader = this.newReader("Iso" + this.readerData + "Reader"); +}break; +case 1334: +this.surfaceReader = this.newReader("IsoIntersectFileReader"); +break; +case 1333: +this.surfaceReader = this.newReader("IsoIntersectAtomReader"); +break; +case 1195: +case 1203: +case 1196: +this.surfaceReader = this.newReader("IsoSolventReader"); +break; +case 1844: +case 1837: +this.surfaceReader = this.newReader("IsoMOReader"); +break; +case 8: +this.surfaceReader = this.newReader("IsoFxyReader"); +break; +case 9: +this.surfaceReader = this.newReader("IsoFxyzReader"); +break; +} +if (JU.Logger.debugging) JU.Logger.info("Using surface reader " + this.surfaceReader); +if (this.params.isSilent && this.surfaceReader != null) this.surfaceReader.isQuiet = true; +return true; +}); +Clazz.defineMethod(c$, "generateSurface", +function(){ +if (++this.params.state != 2) return; +this.setReader(); +if (this.params.sbOut == null) this.params.sbOut = new JU.SB(); +this.jvxlData.sbOut = this.params.sbOut; +var haveMeshDataServer = (this.meshDataServer != null); +if (this.params.colorBySign) this.params.isBicolorMap = true; +if (this.surfaceReader == null) { +JU.Logger.error("surfaceReader is null for " + this.params.dataType); +return; +}if (!this.surfaceReader.createIsosurface(false)) { +JU.Logger.error("Could not create isosurface"); +this.params.cutoff = NaN; +this.params.cutoffRange = null; +this.surfaceReader.closeReader(); +return; +}if (this.params.probes != null) { +for (var i = this.params.probeValues.length; --i >= 0; ) { +this.params.probeValues[i] = this.surfaceReader.getValueAtPoint(this.params.probes[i], false); +} +}if (this.params.pocket != null && haveMeshDataServer) this.surfaceReader.selectPocket(!this.params.pocket.booleanValue()); +if (this.params.minSet > 0) this.surfaceReader.excludeMinimumSet(); +if (this.params.maxSet > 0) this.surfaceReader.excludeMaximumSet(); +if (this.params.slabInfo != null) this.surfaceReader.slabIsosurface(this.params.slabInfo); +if (haveMeshDataServer && this.meshDataServer.notifySurfaceGenerationCompleted()) this.surfaceReader.hasColorData = false; +if (this.jvxlData.thisSet != null) this.getSurfaceSets(); +if (this.jvxlData.jvxlDataIs2dContour) { +this.surfaceReader.colorIsosurface(); +this.params.state = 3; +}if (this.jvxlData.jvxlDataIsColorDensity) { +this.params.state = 3; +}if (this.params.colorBySign || this.params.isBicolorMap) { +this.params.state = 3; +this.surfaceReader.applyColorScale(); +}if (this.jvxlData.vertexColorMap != null) { +this.jvxlData.vertexColorMap = null; +this.surfaceReader.hasColorData = false; +}this.surfaceReader.jvxlUpdateInfo(); +this.marchingSquares = this.surfaceReader.marchingSquares; +this.surfaceReader.discardTempData(false); +this.params.mappedDataMin = 3.4028235E38; +this.surfaceReader.closeReader(); +if (this.params.state != 3 && (this.surfaceReader.hasColorData || this.params.colorDensity)) { +this.params.state = 3; +this.colorIsosurface(); +}this.surfaceReader = null; +}); +Clazz.defineMethod(c$, "mapSurface", +function(){ +if (this.params.state == 1 && this.params.thePlane != null) this.params.state++; +if (++this.params.state < 3) return; +if (!this.setReader()) return; +if (this.params.isPeriodic) this.surfaceReader.volumeData.isPeriodic = true; +if (this.params.thePlane != null) { +var isSquared = this.params.isSquared; +this.params.isSquared = false; +this.params.cutoff = 0; +this.params.cutoffRange = null; +this.surfaceReader.volumeData.setMappingPlane(this.params.thePlane); +this.surfaceReader.createIsosurface(!this.params.isPeriodic); +this.surfaceReader.volumeData.setMappingPlane(null); +if (this.meshDataServer != null) this.meshDataServer.notifySurfaceGenerationCompleted(); +if (this.params.dataType == 1207) { +this.surfaceReader.discardTempData(true); +return; +}this.params.isSquared = isSquared; +this.params.mappedDataMin = 3.4028235E38; +this.surfaceReader.readVolumeData(true); +if (this.params.mapLattice != null) this.surfaceReader.volumeData.isPeriodic = true; +} else if (!this.params.colorBySets && !this.params.colorDensity) { +this.surfaceReader.readAndSetVolumeParameters(true); +this.params.mappedDataMin = 3.4028235E38; +this.surfaceReader.readVolumeData(true); +}this.colorIsosurface(); +this.surfaceReader.closeReader(); +this.surfaceReader = null; +}); +Clazz.defineMethod(c$, "colorIsosurface", +function(){ +this.surfaceReader.colorIsosurface(); +this.surfaceReader.jvxlUpdateInfo(); +this.surfaceReader.updateTriangles(); +this.surfaceReader.discardTempData(true); +if (this.meshDataServer != null) this.meshDataServer.notifySurfaceMappingCompleted(); +}); +Clazz.defineMethod(c$, "getProperty", +function(property, index){ +if (property === "jvxlFileData") return J.jvxl.data.JvxlCoder.jvxlGetFile(this.jvxlData, null, this.params.title, "", true, index, null, null); +if (property === "jvxlFileInfo") return J.jvxl.data.JvxlCoder.jvxlGetInfo(this.jvxlData); +return null; +}, "~S,~N"); +Clazz.defineMethod(c$, "setFileData", +function(vwr, value){ +var fileType = this.fileType; +this.fileType = null; +if (Clazz.instanceOf(value,"java.util.Map")) { +var map = value; +if (map.containsKey("__pymolSurfaceData__")) { +this.readerData = map; +return this.newReaderBr("PyMOLMeshReader", null); +}value = map.get("volumeData"); +}if (Clazz.instanceOf(value,"J.jvxl.data.VolumeData")) { +this.volumeDataTemp = value; +return this.newReader("VolumeDataReader"); +}var data = null; +if ((typeof(value)=='string')) { +data = value; +value = JU.Rdr.getBR(value); +}if (Clazz.instanceOf(value,Array)) { +var a = (value)[0]; +var b = new Array(a.length); +for (var i = 0; i < a.length; i++) { +this.fileType = fileType; +b[i] = this.setFileData(vwr, a[i]); +} +(value)[0] = b; +this.readerData = value; +return this.newReader("IsoIntersectGridReader"); +}var br = value; +if (fileType == null) fileType = JV.FileManager.determineSurfaceFileType(br); +if (fileType != null && fileType.startsWith("UPPSALA")) { +var fname = this.params.fileName; +fname = fname.substring(0, fname.indexOf("/", 10)); +fname += JU.PT.getQuotedStringAt(fileType, fileType.indexOf("A HREF") + 1); +this.params.fileName = fname; +value = this.atomDataServer.getBufferedInputStream(fname); +if (value == null) { +JU.Logger.error("Isosurface: could not open file " + fname); +return null; +}try { +br = JU.Rdr.getBufferedReader(value, null); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +fileType = JV.FileManager.determineSurfaceFileType(br); +}if (fileType == null) fileType = "UNKNOWN"; +JU.Logger.info("data file type was determined to be " + fileType); +if (fileType.equals("Jvxl+")) return this.newReaderBr("JvxlReader", br); +this.readerData = Clazz.newArray(-1, [this.params.fileName, data]); +if ("MRC DELPHI DSN6".indexOf(fileType.toUpperCase()) >= 0) { +fileType += "Binary"; +}return this.newReaderBr(fileType + "Reader", br); +}, "JV.Viewer,~O"); +Clazz.defineMethod(c$, "getReaderData", +function(){ +var o = this.readerData; +this.readerData = null; +return o; +}); +Clazz.defineMethod(c$, "initializeIsosurface", +function(){ +this.params.initialize(); +this.colorPtr = 0; +this.surfaceReader = null; +this.marchingSquares = null; +this.initState(); +}); +Clazz.defineMethod(c$, "initState", +function(){ +this.params.state = 1; +this.params.dataType = this.params.surfaceType = 0; +}); +Clazz.defineMethod(c$, "setLcao", +function(){ +this.params.colorPos = this.params.colorPosLCAO; +this.params.colorNeg = this.params.colorNegLCAO; +return this.params.lcaoType; +}); +Clazz.defineMethod(c$, "getFunctionZfromXY", +function(){ +var origin = this.params.functionInfo.get(1); +var counts = Clazz.newIntArray (3, 0); +var nearest = Clazz.newIntArray (3, 0); +var vectors = new Array(3); +for (var i = 0; i < 3; i++) { +var info = this.params.functionInfo.get(i + 2); +counts[i] = Math.abs(Clazz.floatToInt(info.x)); +vectors[i] = JU.V3.new3(info.y, info.z, info.w); +} +var nx = counts[0]; +var ny = counts[1]; +var pt = new JU.P3(); +var pta = new JU.P3(); +var ptb = new JU.P3(); +var ptc = new JU.P3(); +var data = this.params.functionInfo.get(5); +var data2 = Clazz.newFloatArray (nx, ny, 0); +var d; +for (var i = 0; i < nx; i++) for (var j = 0; j < ny; j++) { +pt.scaleAdd2(i, vectors[0], origin); +pt.scaleAdd2(j, vectors[1], pt); +var dist = J.jvxl.readers.SurfaceGenerator.findNearestThreePoints(pt.x, pt.y, data, nearest); +pta.set((d = data[nearest[0]])[0], d[1], d[2]); +if (dist < 0.00001) { +pt.z = d[2]; +} else { +ptb.set((d = data[nearest[1]])[0], d[1], d[2]); +ptc.set((d = data[nearest[2]])[0], d[1], d[2]); +pt.z = this.distanceVerticalToPlane(pt.x, pt.y, pta, ptb, ptc); +}data2[i][j] = pt.z; +} + +this.params.functionInfo.set(5, data2); +}); +Clazz.defineMethod(c$, "distanceVerticalToPlane", +function(x, y, pta, ptb, ptc){ +var d = JU.Measure.getDirectedNormalThroughPoints(pta, ptb, ptc, this.ptRef, this.vNorm, this.vAB); +return (this.vNorm.x * x + this.vNorm.y * y + d) / -this.vNorm.z; +}, "~N,~N,JU.P3,JU.P3,JU.P3"); +c$.findNearestThreePoints = Clazz.defineMethod(c$, "findNearestThreePoints", +function(x, y, xyz, result){ +var d; +var dist1; +var dist2; +var dist3; +var i1; +var i2; +var i3; +i1 = i2 = i3 = -1; +dist1 = dist2 = dist3 = 3.4028235E38; +for (var i = xyz.length; --i >= 0; ) { +d = (d = xyz[i][0] - x) * d + (d = xyz[i][1] - y) * d; +if (d < dist1) { +dist3 = dist2; +dist2 = dist1; +dist1 = d; +i3 = i2; +i2 = i1; +i1 = i; +} else if (d < dist2) { +dist3 = dist2; +dist2 = d; +i3 = i2; +i2 = i; +} else if (d < dist3) { +dist3 = d; +i3 = i; +}} +result[0] = i1; +result[1] = i2; +result[2] = i3; +return dist1; +}, "~N,~N,~A,~A"); +Clazz.defineMethod(c$, "addRequiredFile", +function(fileName){ +if (this.meshDataServer == null) return; +this.meshDataServer.addRequiredFile(fileName); +}, "~S"); +Clazz.defineMethod(c$, "setRequiredFile", +function(oldName, fileName){ +if (this.meshDataServer == null) return; +this.meshDataServer.setRequiredFile(oldName, fileName); +}, "~S,~S"); +Clazz.defineMethod(c$, "log", +function(msg){ +if (this.atomDataServer == null) System.out.println(msg); + else this.atomDataServer.log(msg); +}, "~S"); +Clazz.defineMethod(c$, "setOutputChannel", +function(binaryDoc, out){ +if (this.meshDataServer == null) return; +this.meshDataServer.setOutputChannel(binaryDoc, out); +}, "javajs.api.GenericBinaryDocument,JU.OC"); +Clazz.defineMethod(c$, "fillAtomData", +function(atomData, mode){ +if ((mode & 2) != 0 && atomData.bsSelected != null) { +if (this.bsVdw == null) this.bsVdw = new JU.BS(); +this.bsVdw.or(atomData.bsSelected); +}this.atomDataServer.fillAtomData(atomData, mode); +}, "J.atomdata.AtomData,~N"); +Clazz.defineMethod(c$, "getOriginVaVbVc", +function(){ +return (this.surfaceReader.volumeData == null ? null : this.surfaceReader.volumeData.oabc); +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/SurfaceReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/SurfaceReader.js new file mode 100755 index 000000000000..14aaf0e698d7 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/SurfaceReader.js @@ -0,0 +1,649 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.api.VertexDataServer", "JU.P3"], "J.jvxl.readers.SurfaceReader", ["JU.AU", "$.BS", "J.jvxl.calc.MarchingCubes", "$.MarchingSquares", "J.jvxl.data.JvxlCoder", "$.MeshData", "JU.BoxInfo", "$.C", "$.ColorEncoder", "$.Escape", "$.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.sg = null; +this.meshDataServer = null; +this.params = null; +this.meshData = null; +this.jvxlData = null; +this.volumeData = null; +this.edgeData = null; +this.haveSurfaceAtoms = false; +this.allowSigma = false; +this.isProgressive = false; +this.isXLowToHigh = false; +this.assocCutoff = 0.3; +this.isQuiet = false; +this.isPeriodic = false; +this.vertexDataOnly = false; +this.hasColorData = false; +this.dataMin = 3.4028235E38; +this.dataMax = -3.4028235E38; +this.dataMean = 0; +this.xyzMin = null; +this.xyzMax = null; +this.center = null; +this.anisotropy = null; +this.isAnisotropic = false; +this.eccentricityMatrix = null; +this.eccentricityMatrixInverse = null; +this.isEccentric = false; +this.eccentricityScale = 0; +this.eccentricityRatio = 0; +this.edgeCount = 0; +this.volumetricOrigin = null; +this.volumetricVectors = null; +this.voxelCounts = null; +this.voxelData = null; +this.nBytes = 0; +this.nDataPoints = 0; +this.nPointsX = 0; +this.nPointsY = 0; +this.nPointsZ = 0; +this.isJvxl = false; +this.edgeFractionBase = 0; +this.edgeFractionRange = 0; +this.colorFractionBase = 0; +this.colorFractionRange = 0; +this.jvxlFileHeaderBuffer = null; +this.fractionData = null; +this.jvxlEdgeDataRead = ""; +this.jvxlColorDataRead = ""; +this.jvxlVoxelBitSet = null; +this.jvxlDataIsColorMapped = false; +this.jvxlDataIsPrecisionColor = false; +this.jvxlDataIs2dContour = false; +this.jvxlDataIsColorDensity = false; +this.jvxlCutoff = 0; +this.jvxlCutoffRange = null; +this.jvxlNSurfaceInts = 0; +this.cJvxlEdgeNaN = '\0'; +this.contourVertexCount = 0; +this.marchingSquares = null; +this.marchingCubes = null; +this.yzPlanes = null; +this.yzCount = 0; +this.qpc = null; +this.ptTemp = null; +this.minMax = null; +this.haveSetAnisotropy = false; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "SurfaceReader", null, J.jvxl.api.VertexDataServer); +Clazz.prepareFields (c$, function(){ +this.ptTemp = new JU.P3(); +}); +Clazz.makeConstructor(c$, +function(){ +}); +Clazz.defineMethod(c$, "initSR", +function(sg){ +this.sg = sg; +this.params = sg.params; +this.assocCutoff = this.params.assocCutoff; +this.isXLowToHigh = this.params.isXLowToHigh; +this.center = this.params.center; +this.anisotropy = this.params.anisotropy; +this.isAnisotropic = this.params.isAnisotropic; +this.eccentricityMatrix = this.params.eccentricityMatrix; +this.eccentricityMatrixInverse = this.params.eccentricityMatrixInverse; +this.isEccentric = this.params.isEccentric; +this.eccentricityScale = this.params.eccentricityScale; +this.eccentricityRatio = this.params.eccentricityRatio; +this.marchingSquares = sg.marchingSquares; +this.meshData = sg.meshData; +this.jvxlData = sg.jvxlData; +this.setVolumeDataV(sg.volumeDataTemp); +this.meshDataServer = sg.meshDataServer; +this.cJvxlEdgeNaN = String.fromCharCode(125); +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.defineMethod(c$, "setOutputChannel", +function(out){ +}, "JU.OC"); +Clazz.defineMethod(c$, "newVoxelDataCube", +function(){ +this.volumeData.setVoxelDataAsArray(this.voxelData = Clazz.newFloatArray (this.nPointsX, this.nPointsY, this.nPointsZ, 0)); +}); +Clazz.defineMethod(c$, "setVolumeDataV", +function(v){ +this.nBytes = 0; +this.volumetricOrigin = v.volumetricOrigin; +this.volumetricVectors = v.volumetricVectors; +this.voxelCounts = v.voxelCounts; +this.voxelData = v.getVoxelData(); +this.volumeData = v; +}, "J.jvxl.data.VolumeData"); +Clazz.defineMethod(c$, "jvxlUpdateInfo", +function(){ +this.jvxlData.jvxlUpdateInfo(this.params.title, this.nBytes); +}); +Clazz.defineMethod(c$, "readAndSetVolumeParameters", +function(isMapData){ +if (!this.readVolumeParameters(isMapData)) return false; +if (this.vertexDataOnly) return true; +return (this.volumeData.setUnitVectors()); +}, "~B"); +Clazz.defineMethod(c$, "createIsosurface", +function(justForPlane){ +this.resetIsosurface(); +if (this.params.showTiming) JU.Logger.startTimer("isosurface creation"); +this.jvxlData.cutoff = NaN; +this.jvxlData.cutoffRange = null; +if (!this.readAndSetVolumeParameters(justForPlane)) return false; +if (!justForPlane && !Float.isNaN(this.params.sigma) && !this.allowSigma) { +if (this.params.sigma > 0) JU.Logger.error("Reader does not support SIGMA option -- using cutoff 1.6"); +this.params.cutoff = 1.6; +}if (this.params.sigma < 0) this.params.sigma = -this.params.sigma; +this.nPointsX = this.voxelCounts[0]; +this.nPointsY = this.voxelCounts[1]; +this.nPointsZ = this.voxelCounts[2]; +this.jvxlData.isSlabbable = ((this.params.dataType & 1024) != 0); +this.jvxlData.insideOut = this.params.isInsideOut(); +this.jvxlData.isBicolorMap = this.params.isBicolorMap; +this.jvxlData.nPointsX = this.nPointsX; +this.jvxlData.nPointsY = this.nPointsY; +this.jvxlData.nPointsZ = this.nPointsZ; +this.jvxlData.jvxlVolumeDataXml = this.volumeData.xmlData; +this.jvxlData.voxelVolume = this.volumeData.voxelVolume; +if (justForPlane) { +this.volumeData.setMappingPlane(this.params.thePlane); +if (this.meshDataServer != null) this.meshDataServer.fillMeshData(this.meshData, 1, null); +this.params.setMapRanges(this, false); +this.generateSurfaceData(); +this.volumeData.setMappingPlane(null); +} else { +if (!this.readVolumeData(false)) return false; +this.generateSurfaceData(); +}if (this.jvxlFileHeaderBuffer == null) { +this.jvxlData.jvxlFileTitle = ""; +this.jvxlData.jvxlFileSource = null; +this.jvxlData.jvxlFileMessage = null; +} else { +var s = this.jvxlFileHeaderBuffer.toString(); +var i = s.indexOf('\n', s.indexOf('\n', s.indexOf('\n') + 1) + 1) + 1; +this.jvxlData.jvxlFileTitle = s.substring(0, i); +this.jvxlData.jvxlFileSource = this.params.fileName; +}if (this.params.contactPair == null) this.setBBoxAll(); +this.jvxlData.isValid = (this.xyzMin.x != 3.4028235E38); +if (!this.params.isSilent) { +if (!this.jvxlData.isValid) JU.Logger.error("no isosurface points were found!"); + else JU.Logger.info("boundbox corners " + JU.Escape.eP(this.xyzMin) + " " + JU.Escape.eP(this.xyzMax)); +}this.jvxlData.boundingBox = Clazz.newArray(-1, [this.xyzMin, this.xyzMax]); +this.jvxlData.dataMin = this.dataMin; +this.jvxlData.dataMax = this.dataMax; +this.jvxlData.cutoffRange = (this.isJvxl ? this.jvxlCutoffRange : this.params.cutoffRange); +this.jvxlData.cutoff = (this.jvxlCutoffRange != null ? this.jvxlData.cutoffRange[0] : this.isJvxl ? this.jvxlCutoff : this.params.cutoff); +this.jvxlData.isCutoffAbsolute = this.params.isCutoffAbsolute; +this.jvxlData.isModelConnected = this.params.isModelConnected; +this.jvxlData.pointsPerAngstrom = 1 / this.volumeData.volumetricVectorLengths[0]; +this.jvxlData.jvxlColorData = ""; +this.jvxlData.jvxlPlane = this.params.thePlane; +this.jvxlData.jvxlEdgeData = this.edgeData; +this.jvxlData.isBicolorMap = this.params.isBicolorMap; +this.jvxlData.isContoured = this.params.isContoured; +this.jvxlData.colorDensity = this.params.colorDensity; +this.jvxlData.pointSize = this.params.pointSize; +if (this.jvxlData.vContours != null) this.params.nContours = this.jvxlData.vContours.length; +this.jvxlData.nContours = (this.params.contourFromZero ? this.params.nContours : -1 - this.params.nContours); +this.jvxlData.thisContour = this.params.thisContour; +this.jvxlData.nEdges = this.edgeCount; +this.jvxlData.edgeFractionBase = this.edgeFractionBase; +this.jvxlData.edgeFractionRange = this.edgeFractionRange; +this.jvxlData.colorFractionBase = this.colorFractionBase; +this.jvxlData.colorFractionRange = this.colorFractionRange; +this.jvxlData.jvxlDataIs2dContour = this.jvxlDataIs2dContour; +this.jvxlData.jvxlDataIsColorMapped = this.jvxlDataIsColorMapped; +this.jvxlData.jvxlDataIsColorDensity = this.jvxlDataIsColorDensity; +this.jvxlData.isXLowToHigh = this.isXLowToHigh; +this.jvxlData.vertexDataOnly = this.vertexDataOnly; +this.jvxlData.saveVertexCount = 0; +if (this.jvxlDataIsColorMapped || this.jvxlData.nVertexColors > 0) { +if (this.meshDataServer != null) { +this.meshDataServer.fillMeshData(this.meshData, 1, null); +this.meshDataServer.fillMeshData(this.meshData, 2, null); +}this.jvxlData.jvxlColorData = this.readColorData(); +this.updateSurfaceData(); +if (this.meshDataServer != null) this.meshDataServer.notifySurfaceMappingCompleted(); +}if (this.params.showTiming) JU.Logger.checkTimer("isosurface creation", false); +return true; +}, "~B"); +Clazz.defineMethod(c$, "resetIsosurface", +function(){ +this.meshData = new J.jvxl.data.MeshData(); +this.xyzMin = this.xyzMax = null; +this.jvxlData.isBicolorMap = this.params.isBicolorMap; +if (this.meshDataServer != null) this.meshDataServer.fillMeshData(null, 0, null); +this.contourVertexCount = 0; +if (this.params.cutoff == 3.4028235E38) this.params.cutoff = 0.02; +this.jvxlData.jvxlSurfaceData = ""; +this.jvxlData.jvxlEdgeData = ""; +this.jvxlData.jvxlColorData = ""; +this.edgeCount = 0; +this.edgeFractionBase = 35; +this.edgeFractionRange = 90; +this.colorFractionBase = 35; +this.colorFractionRange = 90; +this.params.mappedDataMin = 3.4028235E38; +}); +Clazz.defineMethod(c$, "discardTempData", +function(discardAll){ +this.discardTempDataSR(discardAll); +}, "~B"); +Clazz.defineMethod(c$, "discardTempDataSR", +function(discardAll){ +if (!discardAll) return; +this.voxelData = null; +this.sg.marchingSquares = this.marchingSquares = null; +this.marchingCubes = null; +}, "~B"); +Clazz.defineMethod(c$, "initializeVolumetricData", +function(){ +this.nPointsX = this.voxelCounts[0]; +this.nPointsY = this.voxelCounts[1]; +this.nPointsZ = this.voxelCounts[2]; +this.setVolumeDataV(this.volumeData); +}); +Clazz.defineMethod(c$, "gotoAndReadVoxelData", +function(isMapData){ +this.initializeVolumetricData(); +if (this.nPointsX > 0 && this.nPointsY > 0 && this.nPointsZ > 0) try { +this.gotoData(this.params.fileIndex - 1, this.nPointsX * this.nPointsY * this.nPointsZ); +this.readSurfaceData(isMapData); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.error(e.toString()); +return false; +} else { +throw e; +} +} +return true; +}, "~B"); +Clazz.defineMethod(c$, "gotoData", +function(n, nPoints){ +}, "~N,~N"); +Clazz.defineMethod(c$, "readColorData", +function(){ +if (this.jvxlData.vertexColors == null) return ""; +var vertexCount = this.jvxlData.vertexCount; +var colixes = this.meshData.vcs; +var vertexValues = this.meshData.vvs; +if (colixes == null || colixes.length < vertexCount) this.meshData.vcs = colixes = Clazz.newShortArray (vertexCount, 0); +if (vertexValues == null || vertexValues.length < vertexCount) this.meshData.vvs = vertexValues = Clazz.newFloatArray (vertexCount, 0); +for (var i = 0; i < vertexCount; i++) colixes[i] = JU.C.getColix(this.jvxlData.vertexColors[i]); + +return "-"; +}); +Clazz.overrideMethod(c$, "getPlane", +function(x){ +return this.getPlaneSR(x); +}, "~N"); +Clazz.defineMethod(c$, "getPlaneSR", +function(x){ +if (this.yzCount == 0) this.initPlanes(); +if (this.qpc != null) this.qpc.getPlane(x, this.yzPlanes[x % 2]); +return this.yzPlanes[x % 2]; +}, "~N"); +Clazz.defineMethod(c$, "initPlanes", +function(){ +this.yzCount = this.nPointsY * this.nPointsZ; +if (!this.isQuiet) JU.Logger.info("reading data progressively -- yzCount = " + this.yzCount); +this.yzPlanes = JU.AU.newFloat2(2); +this.yzPlanes[0] = Clazz.newFloatArray (this.yzCount, 0); +this.yzPlanes[1] = Clazz.newFloatArray (this.yzCount, 0); +}); +Clazz.overrideMethod(c$, "getValue", +function(x, y, z, ptyz){ +return this.getValue2(x, y, z, ptyz); +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "getValue2", +function(x, y, z, ptyz){ +return (this.yzPlanes == null ? this.voxelData[x][y][z] : this.yzPlanes[x % 2][ptyz]); +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "generateSurfaceData", +function(){ +this.edgeData = ""; +if (this.vertexDataOnly) { +try { +this.readSurfaceData(false); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +System.out.println(e.toString()); +JU.Logger.error("Exception in SurfaceReader::readSurfaceData: " + e.toString()); +} else { +throw e; +} +} +return; +}this.contourVertexCount = 0; +var contourType = -1; +this.marchingSquares = null; +if (this.params.thePlane != null || this.params.isContoured) { +this.marchingSquares = new J.jvxl.calc.MarchingSquares(this, this.volumeData, this.params.thePlane, this.params.contoursDiscrete, this.params.nContours, this.params.thisContour, this.params.contourFromZero); +contourType = this.marchingSquares.contourType; +this.marchingSquares.setMinMax(this.params.valueMappedToRed, this.params.valueMappedToBlue); +}this.params.contourType = contourType; +this.params.isXLowToHigh = this.isXLowToHigh; +this.marchingCubes = new J.jvxl.calc.MarchingCubes(this, this.volumeData, this.params, this.jvxlVoxelBitSet); +var data = this.marchingCubes.getEdgeData(); +if (this.params.thePlane == null) this.edgeData = data; +this.jvxlData.setSurfaceInfoFromBitSetPts(this.marchingCubes.bsVoxels, this.params.thePlane, this.params.mapLattice); +this.jvxlData.jvxlExcluded = this.params.bsExcluded; +if (this.isJvxl) this.edgeData = this.jvxlEdgeDataRead; +this.postProcessVertices(); +}); +Clazz.defineMethod(c$, "postProcessVertices", +function(){ +}); +Clazz.overrideMethod(c$, "getSurfacePointIndexAndFraction", +function(cutoff, isCutoffAbsolute, x, y, z, offset, vA, vB, valueA, valueB, pointA, edgeVector, isContourType, fReturn){ +var thisValue = this.getSurfacePointAndFraction(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, this.ptTemp); +if (this.marchingSquares != null && this.params.isContoured) return this.marchingSquares.addContourVertex(this.ptTemp, cutoff); +var assocVertex = (this.assocCutoff > 0 ? (fReturn[0] < this.assocCutoff ? vA : fReturn[0] > 1 - this.assocCutoff ? vB : -1) : -1); +if (assocVertex >= 0) assocVertex = this.marchingCubes.getLinearOffset(x, y, z, assocVertex); +var n = this.addVertexCopy(this.ptTemp, thisValue, assocVertex, true); +if (n >= 0 && this.params.iAddGridPoints) { +this.marchingCubes.calcVertexPoint(x, y, z, vB, this.ptTemp); +this.addVertexCopy(valueA < valueB ? pointA : this.ptTemp, Math.min(valueA, valueB), -3, true); +this.addVertexCopy(valueA < valueB ? this.ptTemp : pointA, Math.max(valueA, valueB), -3, true); +}return n; +}, "~N,~B,~N,~N,~N,JU.P3i,~N,~N,~N,~N,JU.T3,JU.V3,~B,~A"); +Clazz.defineMethod(c$, "getSurfacePointAndFraction", +function(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, ptReturn){ +return this.getSPF(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, ptReturn); +}, "~N,~B,~N,~N,JU.T3,JU.V3,~N,~N,~N,~N,~N,~A,JU.T3"); +Clazz.defineMethod(c$, "getSPF", +function(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, ptReturn){ +var diff = valueB - valueA; +var fraction = (cutoff - valueA) / diff; +if (isCutoffAbsolute && (fraction < 0 || fraction > 1)) fraction = (-cutoff - valueA) / diff; +if (fraction < 0 || fraction > 1) { +fraction = NaN; +}fReturn[0] = fraction; +ptReturn.scaleAdd2(fraction, edgeVector, pointA); +return valueA + fraction * diff; +}, "~N,~B,~N,~N,JU.T3,JU.V3,~N,~N,~N,~N,~N,~A,JU.T3"); +Clazz.defineMethod(c$, "addVertexCopy", +function(vertexXYZ, value, assocVertex, asCopy){ +return this.addVC(vertexXYZ, value, assocVertex, asCopy); +}, "JU.T3,~N,~N,~B"); +Clazz.defineMethod(c$, "addVC", +function(vertexXYZ, value, assocVertex, asCopy){ +return (Float.isNaN(value) && assocVertex != -3 ? -1 : this.meshDataServer == null ? this.meshData.addVertexCopy(vertexXYZ, value, assocVertex, asCopy) : this.meshDataServer.addVertexCopy(vertexXYZ, value, assocVertex, asCopy)); +}, "JU.T3,~N,~N,~B"); +Clazz.defineMethod(c$, "addTriangleCheck", +function(iA, iB, iC, check, iContour, isAbsolute, color){ +if (this.marchingSquares != null && this.params.isContoured) { +if (color == 0) return this.marchingSquares.addTriangle(iA, iB, iC, check, iContour); +color = 0; +}return (this.meshDataServer != null ? this.meshDataServer.addTriangleCheck(iA, iB, iC, check, iContour, isAbsolute, color) : isAbsolute && !J.jvxl.data.MeshData.checkCutoff(iA, iB, iC, this.meshData.vvs) ? -1 : this.meshData.addTriangleCheck(iA, iB, iC, check, iContour, color)); +}, "~N,~N,~N,~N,~N,~B,~N"); +Clazz.defineMethod(c$, "colorIsosurface", +function(){ +if (this.params.isSquared && this.volumeData != null) this.volumeData.filterData(true, NaN); +if (this.meshDataServer != null) { +this.meshDataServer.fillMeshData(this.meshData, 1, null); +}this.jvxlData.saveVertexCount = 0; +if (this.params.isContoured && this.marchingSquares != null) { +this.initializeMapping(); +this.params.setMapRanges(this, false); +this.marchingSquares.setMinMax(this.params.valueMappedToRed, this.params.valueMappedToBlue); +this.jvxlData.saveVertexCount = this.marchingSquares.contourVertexCount; +this.contourVertexCount = this.marchingSquares.generateContourData(this.jvxlDataIs2dContour, (this.params.isSquared ? 1e-8 : 1e-4)); +this.jvxlData.contourValuesUsed = this.marchingSquares.contourValuesUsed; +this.minMax = this.marchingSquares.getMinMax(); +if (this.meshDataServer != null) this.meshDataServer.notifySurfaceGenerationCompleted(); +this.finalizeMapping(); +}this.applyColorScale(); +this.jvxlData.nContours = (this.params.contourFromZero ? this.params.nContours : -1 - this.params.nContours); +this.jvxlData.thisContour = this.params.thisContour; +this.jvxlData.jvxlFileMessage = "mapped: min = " + this.params.valueMappedToRed + "; max = " + this.params.valueMappedToBlue; +}); +Clazz.defineMethod(c$, "applyColorScale", +function(){ +this.colorFractionBase = this.jvxlData.colorFractionBase = 35; +this.colorFractionRange = this.jvxlData.colorFractionRange = 90; +if (this.params.colorPhase == 0) this.params.colorPhase = 1; +if (this.meshDataServer == null) { +this.meshData.vcs = Clazz.newShortArray (this.meshData.vc, 0); +} else { +this.meshDataServer.fillMeshData(this.meshData, 1, null); +if (this.params.contactPair == null) this.meshDataServer.fillMeshData(this.meshData, 2, null); +}var saveColorData = (this.params.colorDensity || this.params.isBicolorMap || this.params.colorBySign || !this.params.colorByPhase); +if (this.params.contactPair != null) saveColorData = false; +this.jvxlData.isJvxlPrecisionColor = true; +this.jvxlData.vertexCount = (this.contourVertexCount > 0 ? this.contourVertexCount : this.meshData.vc); +this.jvxlData.minColorIndex = -1; +this.jvxlData.maxColorIndex = 0; +this.jvxlData.contourValues = this.params.contoursDiscrete; +this.jvxlData.isColorReversed = this.params.isColorReversed; +if (!this.params.colorDensity) if (this.params.isBicolorMap && !this.params.isContoured || this.params.colorBySign) { +this.jvxlData.minColorIndex = JU.C.getColixTranslucent3(JU.C.getColix(this.params.isColorReversed ? this.params.colorPos : this.params.colorNeg), this.jvxlData.translucency != 0, this.jvxlData.translucency); +this.jvxlData.maxColorIndex = JU.C.getColixTranslucent3(JU.C.getColix(this.params.isColorReversed ? this.params.colorNeg : this.params.colorPos), this.jvxlData.translucency != 0, this.jvxlData.translucency); +}this.jvxlData.isTruncated = (this.jvxlData.minColorIndex >= 0 && !this.params.isContoured); +var useMeshDataValues = this.jvxlDataIs2dContour || this.hasColorData || this.vertexDataOnly || this.params.colorDensity || this.params.isBicolorMap && !this.params.isContoured; +if (!useMeshDataValues) { +if (this.haveSurfaceAtoms && this.meshData.vertexSource == null) this.meshData.vertexSource = Clazz.newIntArray (this.meshData.vc, 0); +var min = 3.4028235E38; +var max = -3.4028235E38; +var value; +this.initializeMapping(); +for (var i = this.meshData.vc; --i >= this.meshData.mergeVertexCount0; ) { +if (this.params.colorBySets) { +value = this.meshData.vertexSets[i]; +} else if (this.params.colorByPhase) { +value = this.getPhase(this.meshData.vs[i]); +} else { +var needSource = this.haveSurfaceAtoms; +value = this.volumeData.lookupInterpolatedVoxelValue(this.meshData.vs[i], needSource); +if (needSource) this.meshData.vertexSource[i] = this.getSurfaceAtomIndex(); +}if (value < min) min = value; +if (value > max && value != 3.4028235E38) max = value; +this.meshData.vvs[i] = value; +} +if (this.params.rangeSelected && this.minMax == null) this.minMax = Clazz.newFloatArray(-1, [min, max]); +this.finalizeMapping(); +}this.params.setMapRanges(this, true); +this.jvxlData.mappedDataMin = this.params.mappedDataMin; +this.jvxlData.mappedDataMax = this.params.mappedDataMax; +this.jvxlData.valueMappedToRed = this.params.valueMappedToRed; +this.jvxlData.valueMappedToBlue = this.params.valueMappedToBlue; +if (this.params.contactPair == null && this.jvxlData.vertexColors == null) this.colorData(); +J.jvxl.data.JvxlCoder.jvxlCreateColorData(this.jvxlData, (saveColorData ? this.meshData.vvs : null)); +if (this.haveSurfaceAtoms && this.meshDataServer != null) this.meshDataServer.fillMeshData(this.meshData, 4, null); +if (this.meshDataServer != null && this.params.colorBySets) this.meshDataServer.fillMeshData(this.meshData, 3, null); +}); +Clazz.defineMethod(c$, "colorData", +function(){ +var vertexValues = this.meshData.vvs; +var vertexColixes = this.meshData.vcs; +this.meshData.pcs = null; +var valueBlue = this.jvxlData.valueMappedToBlue; +var valueRed = this.jvxlData.valueMappedToRed; +var minColorIndex = this.jvxlData.minColorIndex; +var maxColorIndex = this.jvxlData.maxColorIndex; +if (this.params.colorEncoder == null) this.params.colorEncoder = new JU.ColorEncoder(null, null); +this.params.colorEncoder.setRange(this.params.valueMappedToRed, this.params.valueMappedToBlue, this.params.isColorReversed); +for (var i = this.meshData.vc; --i >= 0; ) { +var value = vertexValues[i]; +if (minColorIndex >= 0) { +if (value <= 0) vertexColixes[i] = minColorIndex; + else if (value > 0) vertexColixes[i] = maxColorIndex; +} else { +if (value <= valueRed) value = valueRed; +if (value >= valueBlue) value = valueBlue; +vertexColixes[i] = this.params.colorEncoder.getColorIndex(value); +}} +if ((this.params.nContours > 0 || this.jvxlData.contourValues != null) && this.jvxlData.contourColixes == null) { +var n = (this.jvxlData.contourValues == null ? this.params.nContours : this.jvxlData.contourValues.length); +var colors = this.jvxlData.contourColixes = Clazz.newShortArray (n, 0); +var values = this.jvxlData.contourValues; +if (values == null) values = this.jvxlData.contourValuesUsed; +if (this.jvxlData.contourValuesUsed == null) this.jvxlData.contourValuesUsed = (values == null ? Clazz.newFloatArray (n, 0) : values); +var dv = (valueBlue - valueRed) / (n + 1); +this.params.colorEncoder.setRange(this.params.valueMappedToRed, this.params.valueMappedToBlue, this.params.isColorReversed); +for (var i = 0; i < n; i++) { +var v = (values == null ? valueRed + (i + 1) * dv : values[i]); +this.jvxlData.contourValuesUsed[i] = v; +colors[i] = JU.C.getColixTranslucent(this.params.colorEncoder.getArgb(v)); +} +this.jvxlData.contourColors = JU.C.getHexCodes(colors); +}}); +c$.getColorPhaseIndex = Clazz.defineMethod(c$, "getColorPhaseIndex", +function(color){ +var colorPhase = -1; +for (var i = 0; i < J.jvxl.readers.SurfaceReader.colorPhases.length; i++) if (color.equalsIgnoreCase(J.jvxl.readers.SurfaceReader.colorPhases[i])) { +colorPhase = i; +break; +} +return colorPhase; +}, "~S"); +Clazz.defineMethod(c$, "getPhase", +function(pt){ +switch (this.params.colorPhase) { +case 0: +case -1: +case 1: +return (pt.x > 0 ? 1 : -1); +case 2: +return (pt.y > 0 ? 1 : -1); +case 3: +return (pt.z > 0 ? 1 : -1); +case 4: +return (pt.x * pt.y > 0 ? 1 : -1); +case 5: +return (pt.y * pt.z > 0 ? 1 : -1); +case 6: +return (pt.x * pt.z > 0 ? 1 : -1); +case 7: +return (pt.x * pt.x - pt.y * pt.y > 0 ? 1 : -1); +case 8: +return (pt.z * pt.z * 2 - pt.x * pt.x - pt.y * pt.y > 0 ? 1 : -1); +} +return 1; +}, "JU.T3"); +Clazz.defineMethod(c$, "getMinMaxMappedValues", +function(haveData){ +if (this.minMax != null && this.minMax[0] != 3.4028235E38) return this.minMax; +if (this.params.colorBySets) return (this.minMax = Clazz.newFloatArray(-1, [0, Math.max(this.meshData.nSets - 1, 0)])); +var min = 3.4028235E38; +var max = -3.4028235E38; +if (this.params.usePropertyForColorRange && this.params.theProperty != null) { +for (var i = this.params.theProperty.length; --i >= 0; ) { +if (this.params.rangeSelected && !this.params.bsSelected.get(i)) continue; +var p = this.params.theProperty[i]; +if (Float.isNaN(p)) continue; +if (p < min) min = p; +if (p > max) max = p; +} +return (this.minMax = Clazz.newFloatArray(-1, [min, max])); +}var vertexCount = (this.contourVertexCount > 0 ? this.contourVertexCount : this.meshData.vc); +var vertexes = this.meshData.vs; +var useVertexValue = (haveData || this.jvxlDataIs2dContour || this.vertexDataOnly || this.params.colorDensity); +for (var i = this.meshData.mergeVertexCount0; i < vertexCount; i++) { +var v; +if (useVertexValue) v = this.meshData.vvs[i]; + else v = this.volumeData.lookupInterpolatedVoxelValue(vertexes[i], false); +if (v < min) min = v; +if (v > max && v != 3.4028235E38) max = v; +} +return (this.minMax = Clazz.newFloatArray(-1, [min, max])); +}, "~B"); +Clazz.defineMethod(c$, "updateTriangles", +function(){ +if (this.meshDataServer == null) { +this.meshData.invalidatePolygons(); +} else { +this.meshDataServer.invalidateTriangles(); +}}); +Clazz.defineMethod(c$, "updateSurfaceData", +function(){ +this.meshData.setVertexSets(true); +this.updateTriangles(); +if (this.params.bsExcluded[1] == null) this.params.bsExcluded[1] = new JU.BS(); +this.meshData.updateInvalidatedVertices(this.params.bsExcluded[1]); +}); +Clazz.defineMethod(c$, "selectPocket", +function(doExclude){ +}, "~B"); +Clazz.defineMethod(c$, "excludeMinimumSet", +function(){ +if (this.meshDataServer != null) this.meshDataServer.fillMeshData(this.meshData, 1, null); +this.meshData.getSurfaceSet(); +var bs; +for (var i = this.meshData.nSets; --i >= 0; ) if ((bs = this.meshData.surfaceSet[i]) != null && bs.cardinality() < this.params.minSet) this.meshData.invalidateSurfaceSet(i); + +this.updateSurfaceData(); +if (this.meshDataServer != null) this.meshDataServer.fillMeshData(this.meshData, 3, null); +}); +Clazz.defineMethod(c$, "excludeMaximumSet", +function(){ +if (this.meshDataServer != null) this.meshDataServer.fillMeshData(this.meshData, 1, null); +this.meshData.getSurfaceSet(); +var bs; +for (var i = this.meshData.nSets; --i >= 0; ) if ((bs = this.meshData.surfaceSet[i]) != null && bs.cardinality() > this.params.maxSet) this.meshData.invalidateSurfaceSet(i); + +this.updateSurfaceData(); +if (this.meshDataServer != null) this.meshDataServer.fillMeshData(this.meshData, 3, null); +}); +Clazz.defineMethod(c$, "slabIsosurface", +function(slabInfo){ +if (this.meshDataServer != null) this.meshDataServer.fillMeshData(this.meshData, 1, null); +this.meshData.slabPolygonsList(slabInfo, true); +if (this.meshDataServer != null) this.meshDataServer.fillMeshData(this.meshData, 4, null); +}, "JU.Lst"); +Clazz.defineMethod(c$, "setVertexAnisotropy", +function(pt){ +pt.x *= this.anisotropy[0]; +pt.y *= this.anisotropy[1]; +pt.z *= this.anisotropy[2]; +pt.add(this.center); +}, "JU.T3"); +Clazz.defineMethod(c$, "setVectorAnisotropy", +function(v){ +this.haveSetAnisotropy = true; +v.x *= this.anisotropy[0]; +v.y *= this.anisotropy[1]; +v.z *= this.anisotropy[2]; +}, "JU.T3"); +Clazz.defineMethod(c$, "setVolumetricAnisotropy", +function(){ +if (this.haveSetAnisotropy) return; +this.setVolumetricOriginAnisotropy(); +this.setVectorAnisotropy(this.volumetricVectors[0]); +this.setVectorAnisotropy(this.volumetricVectors[1]); +this.setVectorAnisotropy(this.volumetricVectors[2]); +}); +Clazz.defineMethod(c$, "setVolumetricOriginAnisotropy", +function(){ +this.volumetricOrigin.setT(this.center); +}); +Clazz.defineMethod(c$, "setBBoxAll", +function(){ +if (this.meshDataServer != null) this.meshDataServer.fillMeshData(this.meshData, 1, null); +this.xyzMin = new JU.P3(); +this.xyzMax = new JU.P3(); +this.meshData.setBox(this.xyzMin, this.xyzMax); +}); +Clazz.defineMethod(c$, "setBBox", +function(pt, margin){ +if (this.xyzMin == null) { +this.xyzMin = JU.P3.new3(3.4028235E38, 3.4028235E38, 3.4028235E38); +this.xyzMax = JU.P3.new3(-3.4028235E38, -3.4028235E38, -3.4028235E38); +}JU.BoxInfo.addPoint(pt, this.xyzMin, this.xyzMax, margin); +}, "JU.T3,~N"); +Clazz.defineMethod(c$, "getValueAtPoint", +function(pt, getSource){ +return 0; +}, "JU.T3,~B"); +Clazz.defineMethod(c$, "initializeMapping", +function(){ +}); +Clazz.defineMethod(c$, "finalizeMapping", +function(){ +}); +Clazz.defineMethod(c$, "getSurfaceAtomIndex", +function(){ +return -1; +}); +c$.colorPhases = Clazz.newArray(-1, ["_orb", "x", "y", "z", "xy", "yz", "xz", "x2-y2", "z2"]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/UhbdReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/UhbdReader.js new file mode 100755 index 000000000000..1566603341d4 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/UhbdReader.js @@ -0,0 +1,53 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.VolumeFileReader"], "J.jvxl.readers.UhbdReader", ["JU.SB"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.planeCount = 0; +this.voxelCount = 0; +this.pt = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "UhbdReader", J.jvxl.readers.VolumeFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.UhbdReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2VFR(sg, br); +if (this.params.thePlane == null) this.params.insideOut = !this.params.insideOut; +this.isAngstroms = true; +this.nSurfaces = 1; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +this.rd(); +this.jvxlFileHeaderBuffer = JU.SB.newS(this.line); +this.jvxlFileHeaderBuffer.append("UHBD format ").append(this.line).append("\n"); +this.jvxlFileHeaderBuffer.append("see http://sourceforge.net/p/apbs/code/ci/9527462a39126fb6cd880924b3cc4880ec4b78a9/tree/src/mg/vgrid.c\n"); +this.rd(); +this.rd(); +this.voxelCounts[0] = this.parseIntStr(this.line.substring(0, 7)); +this.voxelCounts[1] = this.parseIntStr(this.line.substring(7, 14)); +this.voxelCounts[2] = this.parseIntStr(this.line.substring(14, 21)); +var dx = this.parseFloatStr(this.line.substring(21, 33)); +this.volumetricOrigin.set(this.parseFloatStr(this.line.substring(33, 45)), this.parseFloatStr(this.line.substring(45, 57)), this.parseFloatStr(this.line.substring(57, 69))); +this.volumetricVectors[0].set(0, 0, dx); +this.volumetricVectors[1].set(0, dx, 0); +this.volumetricVectors[2].set(dx, 0, 0); +this.planeCount = this.voxelCounts[0] * this.voxelCounts[1]; +this.rd(); +this.rd(); +}); +Clazz.overrideMethod(c$, "nextVoxel", +function(){ +if (this.voxelCount % this.planeCount == 0) { +this.rd(); +this.pt = 0; +}if (this.pt % 78 == 0) { +this.rd(); +this.pt = 0; +}this.voxelCount++; +var voxelValue = this.parseFloatStr(this.line.substring(this.pt, this.pt + 13)); +this.pt += 13; +return voxelValue; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/VaspChgcarReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/VaspChgcarReader.js new file mode 100755 index 000000000000..9163233819d7 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/VaspChgcarReader.js @@ -0,0 +1,74 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.PeriodicVolumeFileReader"], "J.jvxl.readers.VaspChgcarReader", ["JU.PT", "$.SB", "JU.Logger", "$.SimpleUnitCell"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.volume = 0; +this.pt = 0; +this.nPerLine = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "VaspChgcarReader", J.jvxl.readers.PeriodicVolumeFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.VaspChgcarReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2VFR(sg, br); +this.isAngstroms = true; +this.isPeriodic = true; +this.isProgressive = false; +this.nSurfaces = 1; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +this.jvxlFileHeaderBuffer = new JU.SB(); +this.jvxlFileHeaderBuffer.append("Vasp CHGCAR format\n\n\n"); +this.rd(); +var scale = this.parseFloatStr(this.rd()); +var data = Clazz.newFloatArray (15, 0); +data[0] = -1; +for (var i = 0, pt = 6; i < 3; ++i) this.volumetricVectors[i].set(data[pt++] = this.parseFloatStr(this.rd()) * scale, data[pt++] = this.parseFloat() * scale, data[pt++] = this.parseFloat() * scale); + +this.volume = JU.SimpleUnitCell.newA(data).volume; +while (this.rd().length > 2) { +} +this.rd(); +var counts = this.getTokens(); +for (var i = 0; i < 3; ++i) { +this.volumetricVectors[i].scale(1 / ((this.voxelCounts[i] = this.parseIntStr(counts[i]) + 1) - 1)); +if (this.isAnisotropic) this.setVectorAnisotropy(this.volumetricVectors[i]); +} +this.swapXZ(); +this.volumetricOrigin.set(0, 0, 0); +if (this.params.thePlane == null && (this.params.cutoffAutomatic || !Float.isNaN(this.params.sigma))) { +this.params.cutoff = 0.5; +JU.Logger.info("Cutoff set to " + this.params.cutoff); +}}); +Clazz.overrideMethod(c$, "nextVoxel", +function(){ +if (this.pt++ % this.nPerLine == 0 && this.nData > 0) { +this.rd(); +this.next[0] = 0; +}return this.parseFloat() / this.volume; +}); +Clazz.overrideMethod(c$, "getPeriodicVoxels", +function(){ +var ni = this.voxelCounts[0] - 1; +var nj = this.voxelCounts[1] - 1; +var nk = this.voxelCounts[2] - 1; +var downSampling = (this.nSkipX > 0); +this.nPerLine = JU.PT.countTokens(this.rd(), 0); +for (var i = 0; i < ni; i++) { +for (var j = 0; j < nj; j++) { +for (var k = 0; k < nk; k++) { +this.voxelData[i][j][k] = this.recordData(this.nextVoxel()); +if (downSampling) for (var m = this.nSkipX; --m >= 0; ) this.nextVoxel(); + +} +if (downSampling) for (var m = this.nSkipY; --m >= 0; ) this.nextVoxel(); + +} +if (downSampling) for (var m = this.nSkipZ; --m >= 0; ) this.nextVoxel(); + +} +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/VolumeDataReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/VolumeDataReader.js new file mode 100755 index 000000000000..d8f53bcbe70f --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/VolumeDataReader.js @@ -0,0 +1,181 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.SurfaceReader"], "J.jvxl.readers.VolumeDataReader", ["JU.AU", "$.SB", "J.jvxl.data.JvxlCoder", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.dataType = 0; +this.precalculateVoxelData = false; +this.allowMapData = false; +this.point = null; +this.ptsPerAngstrom = 0; +this.maxGrid = 0; +this.useOriginStepsPoints = false; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "VolumeDataReader", J.jvxl.readers.SurfaceReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.VolumeDataReader, []); +}); +Clazz.overrideMethod(c$, "init", +function(sg){ +this.initVDR(sg); +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.defineMethod(c$, "initVDR", +function(sg){ +this.initSR(sg); +this.useOriginStepsPoints = (this.params.origin != null && this.params.points != null && this.params.steps != null); +this.dataType = this.params.dataType; +this.precalculateVoxelData = true; +this.allowMapData = true; +}, "J.jvxl.readers.SurfaceGenerator"); +Clazz.defineMethod(c$, "setup", +function(isMapData){ +this.jvxlFileHeaderBuffer = new JU.SB().append("volume data read from file\n\n"); +J.jvxl.data.JvxlCoder.jvxlCreateHeaderWithoutTitleOrAtoms(this.volumeData, this.jvxlFileHeaderBuffer); +}, "~B"); +Clazz.overrideMethod(c$, "readVolumeParameters", +function(isMapData){ +this.setup(isMapData); +this.initializeVolumetricData(); +return true; +}, "~B"); +Clazz.overrideMethod(c$, "readVolumeData", +function(isMapData){ +try { +this.readSurfaceData(isMapData); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +System.out.println(e.toString()); +{ +}return false; +} else { +throw e; +} +} +return true; +}, "~B"); +Clazz.defineMethod(c$, "readVoxelDataIndividually", +function(isMapData){ +if (isMapData && !this.allowMapData) return; +if (!isMapData || this.volumeData.sr != null) { +this.volumeData.setVoxelDataAsArray(this.voxelData = null); +return; +}this.newVoxelDataCube(); +for (var x = 0; x < this.nPointsX; ++x) { +var plane = JU.AU.newFloat2(this.nPointsY); +this.voxelData[x] = plane; +var ptyz = 0; +for (var y = 0; y < this.nPointsY; ++y) { +var strip = plane[y] = Clazz.newFloatArray (this.nPointsZ, 0); +for (var z = 0; z < this.nPointsZ; ++z, ++ptyz) { +strip[z] = this.getValue(x, y, z, ptyz); +} +} +} +}, "~B"); +Clazz.defineMethod(c$, "setVolumeData", +function(){ +}); +Clazz.defineMethod(c$, "setVolumeDataParams", +function(){ +if (this.params.volumeData != null) { +this.setVolumeDataV(this.params.volumeData); +return true; +}if (!this.useOriginStepsPoints) { +return false; +}this.volumetricOrigin.setT(this.params.origin); +this.volumetricVectors[0].set(this.params.steps.x, 0, 0); +this.volumetricVectors[1].set(0, this.params.steps.y, 0); +this.volumetricVectors[2].set(0, 0, this.params.steps.z); +this.voxelCounts[0] = Clazz.floatToInt(this.params.points.x); +this.voxelCounts[1] = Clazz.floatToInt(this.params.points.y); +this.voxelCounts[2] = Clazz.floatToInt(this.params.points.z); +if (this.voxelCounts[0] < 1 || this.voxelCounts[1] < 1 || this.voxelCounts[2] < 1) return false; +this.showGridInfo(); +return true; +}); +Clazz.defineMethod(c$, "showGridInfo", +function(){ +JU.Logger.info("grid origin = " + this.params.origin); +JU.Logger.info("grid steps = " + this.params.steps); +JU.Logger.info("grid points = " + this.params.points); +this.ptTemp.x = this.params.steps.x * this.params.points.x; +this.ptTemp.y = this.params.steps.y * this.params.points.y; +this.ptTemp.z = this.params.steps.z * this.params.points.z; +JU.Logger.info("grid lengths = " + this.ptTemp); +this.ptTemp.add(this.params.origin); +JU.Logger.info("grid max xyz = " + this.ptTemp); +}); +Clazz.defineMethod(c$, "setVoxelRange", +function(index, min, max, ptsPerAngstrom, gridMax, minPointsPerAngstrom){ +var nGrid; +var d; +if (min - max >= -1.0E-4) { +min = -10; +max = 10; +}var range = max - min; +var resolution = this.params.resolution; +if (resolution != 3.4028235E38) { +ptsPerAngstrom = resolution; +minPointsPerAngstrom = 0; +}nGrid = Clazz.doubleToInt(Math.floor(range * ptsPerAngstrom)) + 1; +if (nGrid > gridMax) { +if ((this.dataType & 256) > 0) { +if (resolution == 3.4028235E38) { +if (!this.isQuiet) JU.Logger.info("Maximum number of voxels for index=" + index + " exceeded (" + nGrid + ") -- set to " + gridMax); +nGrid = gridMax; +} else { +if (!this.isQuiet) JU.Logger.info("Warning -- high number of grid points: " + nGrid); +}} else if (resolution == 3.4028235E38) { +nGrid = gridMax; +}}if (nGrid == 1) nGrid = 2; +ptsPerAngstrom = (nGrid - 1) / range; +if (ptsPerAngstrom < minPointsPerAngstrom) { +ptsPerAngstrom = minPointsPerAngstrom; +nGrid = Clazz.doubleToInt(Math.floor(ptsPerAngstrom * range + 1)); +ptsPerAngstrom = (nGrid - 1) / range; +}d = this.volumeData.volumetricVectorLengths[index] = 1 / ptsPerAngstrom; +this.voxelCounts[index] = nGrid; +if (this.params.sbOut != null) this.params.sbOut.append("isosurface resolution for axis " + (index + 1) + " set to " + ptsPerAngstrom + " points/Angstrom; " + this.voxelCounts[index] + " voxels\n"); +switch (index) { +case 0: +this.volumetricVectors[0].set(d, 0, 0); +this.volumetricOrigin.x = min; +break; +case 1: +this.volumetricVectors[1].set(0, d, 0); +this.volumetricOrigin.y = min; +break; +case 2: +this.volumetricVectors[2].set(0, 0, d); +this.volumetricOrigin.z = min; +if (this.isEccentric) this.eccentricityMatrix.rotate(this.volumetricOrigin); +if (this.center != null && !Float.isNaN(this.center.x)) this.volumetricOrigin.add(this.center); +if (this.params.sbOut != null) this.params.sbOut.append((this.voxelCounts[0] * this.voxelCounts[1] * this.voxelCounts[2]) + " voxels total\n"); +} +if (this.isEccentric) this.eccentricityMatrix.rotate(this.volumetricVectors[index]); +return this.voxelCounts[index]; +}, "~N,~N,~N,~N,~N,~N"); +Clazz.overrideMethod(c$, "readSurfaceData", +function(isMapData){ +this.readSurfaceDataVDR(isMapData); +}, "~B"); +Clazz.defineMethod(c$, "readSurfaceDataVDR", +function(isMapData){ +if (this.isProgressive && !isMapData) { +this.nDataPoints = this.volumeData.setVoxelCounts(this.nPointsX, this.nPointsY, this.nPointsZ); +this.voxelData = null; +return; +}if (this.precalculateVoxelData) this.generateCube(); + else this.readVoxelDataIndividually(isMapData); +}, "~B"); +Clazz.defineMethod(c$, "generateCube", +function(){ +JU.Logger.info("data type: user volumeData"); +JU.Logger.info("voxel grid origin:" + this.volumetricOrigin); +for (var i = 0; i < 3; ++i) JU.Logger.info("voxel grid vector:" + this.volumetricVectors[i]); + +JU.Logger.info("Read " + this.nPointsX + " x " + this.nPointsY + " x " + this.nPointsZ + " data points"); +}); +Clazz.overrideMethod(c$, "closeReader", +function(){ +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/VolumeFileReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/VolumeFileReader.js new file mode 100755 index 000000000000..aa72e126c55e --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/VolumeFileReader.js @@ -0,0 +1,411 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.SurfaceFileReader"], "J.jvxl.readers.VolumeFileReader", ["JU.AU", "$.PT", "$.SB", "J.api.Interface", "J.atomdata.AtomData", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.endOfData = false; +this.negativeAtomCount = false; +this.ac = 0; +this.nSurfaces = 0; +this.isAngstroms = false; +this.canDownsample = false; +this.downsampleRemainders = null; +this.getNCIPlanes = false; +this.nData = 0; +this.readerClosed = false; +this.downsampleFactor = 0; +this.nSkipX = 0; +this.nSkipY = 0; +this.nSkipZ = 0; +this.yzPlanesRaw = null; +this.iPlaneNCI = 0; +this.boundingBox = null; +this.isScaledAlready = false; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "VolumeFileReader", J.jvxl.readers.SurfaceFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.VolumeFileReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2VFR(sg, br); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.defineMethod(c$, "init2VFR", +function(sg, br){ +this.init2SFR(sg, br); +this.canDownsample = this.isProgressive = this.isXLowToHigh = true; +this.jvxlData.wasCubic = true; +this.boundingBox = this.params.boundingBox; +if (this.params.qmOrbitalType == 4) { +this.hasColorData = (this.params.parameters == null || this.params.parameters[1] >= 0); +this.getNCIPlanes = true; +this.params.insideOut = !this.params.insideOut; +}}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.defineMethod(c$, "recordData", +function(value){ +if (Float.isNaN(value)) return value; +if (value < this.dataMin) this.dataMin = value; +if (value > this.dataMax) this.dataMax = value; +this.dataMean += value; +this.nData++; +return value; +}, "~N"); +Clazz.overrideMethod(c$, "closeReader", +function(){ +if (this.readerClosed) return; +this.readerClosed = true; +this.closeReaderSFR(); +if (this.nData == 0 || this.dataMax == -3.4028235E38) return; +this.dataMean /= this.nData; +JU.Logger.info("VolumeFileReader closing file: " + this.nData + " points read \ndata min/max/mean = " + this.dataMin + "/" + this.dataMax + "/" + this.dataMean); +}); +Clazz.overrideMethod(c$, "readVolumeParameters", +function(isMapData){ +this.endOfData = false; +this.nSurfaces = this.readVolumetricHeader(); +if (this.nSurfaces == 0) return false; +if (this.nSurfaces < this.params.fileIndex) { +JU.Logger.warn("not enough surfaces in file -- resetting params.fileIndex to " + this.nSurfaces); +this.params.fileIndex = this.nSurfaces; +}return true; +}, "~B"); +Clazz.overrideMethod(c$, "readVolumeData", +function(isMapData){ +return this.readVolumeDataVFR(isMapData); +}, "~B"); +Clazz.defineMethod(c$, "readVolumeDataVFR", +function(isMapData){ +if (!this.gotoAndReadVoxelData(isMapData)) return false; +if (!this.vertexDataOnly) JU.Logger.info("JVXL read: " + this.nPointsX + " x " + this.nPointsY + " x " + this.nPointsZ + " data points"); +return true; +}, "~B"); +Clazz.defineMethod(c$, "readVolumetricHeader", +function(){ +try { +this.readParameters(); +if (this.ac == -2147483648) return 0; +if (!this.vertexDataOnly) JU.Logger.info("voxel grid origin:" + this.volumetricOrigin); +var downsampleFactor = this.params.downsampleFactor; +var downsampling = (this.canDownsample && downsampleFactor > 1); +if (downsampleFactor > 1 && !this.canDownsample) this.jvxlData.msg += "\ncannot downsample this file type"; +if (downsampling) { +this.downsampleRemainders = Clazz.newIntArray (3, 0); +JU.Logger.info("downsample factor = " + downsampleFactor); +for (var i = 0; i < 3; ++i) { +var n = this.voxelCounts[i]; +this.downsampleRemainders[i] = n % downsampleFactor; +this.voxelCounts[i] /= downsampleFactor; +if (this.isPeriodic) { +this.voxelCounts[i]++; +this.downsampleRemainders[i]--; +}this.volumetricVectors[i].scale(downsampleFactor); +JU.Logger.info("downsampling axis " + (i + 1) + " from " + n + " to " + this.voxelCounts[i]); +} +}if (!this.vertexDataOnly) for (var i = 0; i < 3; ++i) { +if (!this.isAngstroms) this.volumetricVectors[i].scale(0.5291772); +this.line = this.voxelCounts[i] + " " + this.volumetricVectors[i].x + " " + this.volumetricVectors[i].y + " " + this.volumetricVectors[i].z; +JU.Logger.info("voxel grid count/vector:" + this.line); +} +this.scaleIsosurface(this.params.scale); +this.volumeData.setVolumetricXml(); +return this.nSurfaces; +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.error(e.toString()); +return 0; +} else { +throw e; +} +} +}); +Clazz.defineMethod(c$, "skipComments", +function(allowBlankLines){ +var sb = new JU.SB(); +while (this.rd() != null && (allowBlankLines && this.line.length == 0 || this.line.indexOf("#") == 0)) sb.append(this.line).appendC('\n'); + +return sb.toString(); +}, "~B"); +Clazz.defineMethod(c$, "readVoxelVector", +function(voxelVectorIndex){ +this.rd(); +var voxelVector = this.volumetricVectors[voxelVectorIndex]; +if ((this.voxelCounts[voxelVectorIndex] = this.parseIntStr(this.line)) == -2147483648) this.next[0] = this.line.indexOf(" "); +voxelVector.set(this.parseFloat(), this.parseFloat(), this.parseFloat()); +if (this.isAnisotropic) this.setVectorAnisotropy(voxelVector); +}, "~N"); +Clazz.defineMethod(c$, "initializeSurfaceData", +function(){ +this.downsampleFactor = this.params.downsampleFactor; +this.nSkipX = 0; +this.nSkipY = 0; +this.nSkipZ = 0; +if (this.canDownsample && this.downsampleFactor > 0) { +this.nSkipX = this.downsampleFactor - 1; +this.nSkipY = this.downsampleRemainders[2] + (this.downsampleFactor - 1) * (this.nSkipZ = ((this.nPointsZ - (this.isPeriodic ? 1 : 0)) * this.downsampleFactor + this.downsampleRemainders[2])); +this.nSkipZ = this.downsampleRemainders[1] * this.nSkipZ + (this.downsampleFactor - 1) * this.nSkipZ * ((this.nPointsY - (this.isPeriodic ? 1 : 0)) * this.downsampleFactor + this.downsampleRemainders[1]); +}if (this.params.thePlane != null) { +this.params.cutoff = 0; +} else if (this.isJvxl) { +this.params.cutoff = (this.params.isBicolorMap || this.params.colorBySign ? 0.01 : this.getJVXLCutoff()); +}this.nDataPoints = 0; +this.next[0] = 0; +this.line = ""; +this.jvxlNSurfaceInts = 0; +}); +Clazz.defineMethod(c$, "getJVXLCutoff", +function(){ +return 0.5; +}); +Clazz.overrideMethod(c$, "readSurfaceData", +function(isMapData){ +this.readSurfaceDataVFR(isMapData); +}, "~B"); +Clazz.defineMethod(c$, "readSurfaceDataVFR", +function(isMapData){ +this.initializeSurfaceData(); +if (this.isProgressive && !isMapData || this.isJvxl) { +this.nDataPoints = this.volumeData.setVoxelCounts(this.nPointsX, this.nPointsY, this.nPointsZ); +this.voxelData = null; +if (this.isJvxl) this.jvxlVoxelBitSet = this.getVoxelBitSet(this.nDataPoints); +} else if (isMapData && this.volumeData.hasPlane()) { +this.volumeData.setVoxelMap(); +var f = this.volumeData.getToPlaneParameter(); +for (var x = 0; x < this.nPointsX; ++x) { +for (var y = 0; y < this.nPointsY; ++y) { +for (var z = 0; z < this.nPointsZ; ++z) { +var v = this.recordData(this.getNextVoxelValue()); +if (this.volumeData.isNearPlane(x, y, z, f)) this.volumeData.setVoxelMapValue(x, y, z, v); +if (this.nSkipX != 0) this.skipVoxels(this.nSkipX); +} +if (this.nSkipY != 0) this.skipVoxels(this.nSkipY); +} +if (this.nSkipZ != 0) this.skipVoxels(this.nSkipZ); +} +} else { +this.voxelData = JU.AU.newFloat3(this.nPointsX, -1); +for (var x = 0; x < this.nPointsX; ++x) { +var plane = JU.AU.newFloat2(this.nPointsY); +this.voxelData[x] = plane; +for (var y = 0; y < this.nPointsY; ++y) { +var strip = Clazz.newFloatArray (this.nPointsZ, 0); +plane[y] = strip; +for (var z = 0; z < this.nPointsZ; ++z) { +strip[z] = this.recordData(this.getNextVoxelValue()); +if (this.nSkipX != 0) this.skipVoxels(this.nSkipX); +} +if (this.nSkipY != 0) this.skipVoxels(this.nSkipY); +} +if (this.nSkipZ != 0) this.skipVoxels(this.nSkipZ); +} +}this.volumeData.setVoxelDataAsArray(this.voxelData); +}, "~B"); +Clazz.overrideMethod(c$, "getPlane", +function(x){ +if (x == 0) this.initPlanes(); +if (this.getNCIPlanes) return this.getPlaneNCI(x); +var plane = this.getPlaneSR(x); +if (this.qpc == null) this.getPlaneVFR(plane, true); +return plane; +}, "~N"); +Clazz.defineMethod(c$, "getPlaneNCI", +function(x){ +var plane; +if (this.iPlaneNCI == 0) { +this.qpc = J.api.Interface.getOption("quantum.NciCalculation", this.sg.atomDataServer, null); +var atomData = new J.atomdata.AtomData(); +atomData.modelIndex = -1; +atomData.bsSelected = this.params.bsSelected; +this.sg.fillAtomData(atomData, 1); +(this.qpc).setupCalculation(this.volumeData, this.sg.params.bsSelected, null, null, atomData.atoms, -1, true, null, this.params.parameters, this.params.testFlags); +this.iPlaneNCI = 1; +this.qpc.setPlanes(this.yzPlanesRaw = Clazz.newFloatArray (4, this.yzCount, 0)); +if (this.hasColorData) { +this.getPlaneVFR(this.yzPlanesRaw[0], false); +this.getPlaneVFR(this.yzPlanesRaw[1], false); +plane = this.yzPlanes[0]; +for (var i = 0; i < this.yzCount; i++) plane[i] = NaN; + +return plane; +}this.iPlaneNCI = -1; +}var nan = this.qpc.getNoValue(); +var x1 = this.nPointsX - 1; +switch (this.iPlaneNCI) { +case -1: +plane = this.yzPlanes[x % 2]; +x1++; +break; +case 3: +plane = this.yzPlanesRaw[0]; +this.yzPlanesRaw[0] = this.yzPlanesRaw[1]; +this.yzPlanesRaw[1] = this.yzPlanesRaw[2]; +this.yzPlanesRaw[2] = this.yzPlanesRaw[3]; +this.yzPlanesRaw[3] = plane; +plane = this.yzPlanesRaw[this.iPlaneNCI]; +break; +default: +this.iPlaneNCI++; +plane = this.yzPlanesRaw[this.iPlaneNCI]; +} +if (x < x1) { +this.getPlaneVFR(plane, false); +this.qpc.calcPlane(x, plane = this.yzPlanes[x % 2]); +for (var i = 0; i < this.yzCount; i++) if (plane[i] != nan) this.recordData(plane[i]); + +} else { +for (var i = 0; i < this.yzCount; i++) plane[i] = NaN; + +}return plane; +}, "~N"); +Clazz.defineMethod(c$, "getPlaneVFR", +function(plane, doRecord){ +try { +for (var y = 0, ptyz = 0; y < this.nPointsY; ++y) { +for (var z = 0; z < this.nPointsZ; ++z) { +var v = this.getNextVoxelValue(); +if (doRecord) this.recordData(v); +plane[ptyz++] = v; +if (this.nSkipX != 0) this.skipVoxels(this.nSkipX); +} +if (this.nSkipY != 0) this.skipVoxels(this.nSkipY); +} +if (this.nSkipZ != 0) this.skipVoxels(this.nSkipZ); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +} else { +throw e; +} +} +}, "~A,~B"); +Clazz.overrideMethod(c$, "getValue", +function(x, y, z, ptyz){ +if (this.boundingBox != null) { +this.volumeData.voxelPtToXYZ(x, y, z, this.ptTemp); +if (this.ptTemp.x < this.boundingBox[0].x || this.ptTemp.x > this.boundingBox[1].x || this.ptTemp.y < this.boundingBox[0].y || this.ptTemp.y > this.boundingBox[1].y || this.ptTemp.z < this.boundingBox[0].z || this.ptTemp.z > this.boundingBox[1].z) return NaN; +}return this.getValue2(x, y, z, ptyz); +}, "~N,~N,~N,~N"); +Clazz.defineMethod(c$, "skipVoxels", +function(n){ +for (var i = n; --i >= 0; ) this.getNextVoxelValue(); + +}, "~N"); +Clazz.defineMethod(c$, "getVoxelBitSet", +function(nPoints){ +return null; +}, "~N"); +Clazz.defineMethod(c$, "getNextVoxelValue", +function(){ +var voxelValue = 0; +if (this.nSurfaces > 1 && !this.params.blockCubeData) { +for (var i = 1; i < this.params.fileIndex; i++) this.nextVoxel(); + +voxelValue = this.nextVoxel(); +for (var i = this.params.fileIndex; i < this.nSurfaces; i++) this.nextVoxel(); + +} else { +voxelValue = this.nextVoxel(); +}return voxelValue; +}); +Clazz.defineMethod(c$, "nextVoxel", +function(){ +var voxelValue = this.parseFloat(); +if (Float.isNaN(voxelValue)) { +while (this.rd() != null && Float.isNaN(voxelValue = this.parseFloatStr(this.line))) { +} +if (this.line == null) { +if (!this.endOfData) JU.Logger.warn("end of file reading cube voxel data? nBytes=" + this.nBytes + " nDataPoints=" + this.nDataPoints + " (line):" + this.line); +this.endOfData = true; +this.line = "0 0 0 0 0 0 0 0 0 0"; +}}return voxelValue; +}); +Clazz.overrideMethod(c$, "gotoData", +function(n, nPoints){ +if (!this.params.blockCubeData) return; +if (n > 0) JU.Logger.info("skipping " + n + " data sets, " + nPoints + " points each"); +for (var i = 0; i < n; i++) this.skipData(nPoints); + +}, "~N,~N"); +Clazz.defineMethod(c$, "skipData", +function(nPoints){ +this.skipDataVFR(nPoints); +}, "~N"); +Clazz.defineMethod(c$, "skipDataVFR", +function(nPoints){ +var iV = 0; +while (iV < nPoints) iV += this.countData(this.rd()); + +}, "~N"); +Clazz.defineMethod(c$, "countData", +function(str){ +var count = 0; +var ich = 0; +var ichMax = str.length; +var ch; +while (ich < ichMax) { +while (ich < ichMax && ((ch = str.charAt(ich)) == ' ' || ch == '\t')) ++ich; + +if (ich < ichMax) ++count; +while (ich < ichMax && ((ch = str.charAt(ich)) != ' ' && ch != '\t')) ++ich; + +} +return count; +}, "~S"); +c$.checkAtomLine = Clazz.defineMethod(c$, "checkAtomLine", +function(isXLowToHigh, isAngstroms, strAtomCount, atomLine, bs){ +if (atomLine.indexOf("ANGSTROMS") >= 0) isAngstroms = true; +var ac = (strAtomCount == null ? 2147483647 : JU.PT.parseInt(strAtomCount)); +switch (ac) { +case -2147483648: +ac = 0; +atomLine = " " + atomLine.substring(atomLine.indexOf(" ") + 1); +break; +case 2147483647: +ac = -2147483648; +break; +default: +var s = "" + ac; +atomLine = atomLine.substring(atomLine.indexOf(s) + s.length); +} +if (isAngstroms) { +if (atomLine.indexOf("ANGSTROM") < 0) atomLine += " ANGSTROMS"; +} else { +if (atomLine.indexOf("BOHR") < 0) atomLine += " BOHR"; +}atomLine = (ac == -2147483648 ? "" : (isXLowToHigh ? "+" : "-") + Math.abs(ac)) + atomLine + "\n"; +bs.append(atomLine); +return isAngstroms; +}, "~B,~B,~S,~S,JU.SB"); +Clazz.overrideMethod(c$, "getSurfacePointAndFraction", +function(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, ptReturn){ +return this.getSPFv(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, ptReturn); +}, "~N,~B,~N,~N,JU.T3,JU.V3,~N,~N,~N,~N,~N,~A,JU.T3"); +Clazz.defineMethod(c$, "getSPFv", +function(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, ptReturn){ +var zero = this.getSPF(cutoff, isCutoffAbsolute, valueA, valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, ptReturn); +if (this.qpc == null || Float.isNaN(zero) || !this.hasColorData) return zero; +vA = this.marchingCubes.getLinearOffset(x, y, z, vA); +vB = this.marchingCubes.getLinearOffset(x, y, z, vB); +return this.qpc.process(vA, vB, fReturn[0]); +}, "~N,~B,~N,~N,JU.T3,JU.V3,~N,~N,~N,~N,~N,~A,JU.T3"); +Clazz.defineMethod(c$, "scaleIsosurface", +function(scale){ +if (this.isScaledAlready) return; +this.isScaledAlready = true; +if (this.isAnisotropic) this.setVolumetricAnisotropy(); +if (Float.isNaN(scale)) return; +JU.Logger.info("applying scaling factor of " + scale); +this.volumetricOrigin.scaleAdd2((1 - scale) / 2, this.volumetricVectors[0], this.volumetricOrigin); +this.volumetricOrigin.scaleAdd2((1 - scale) / 2, this.volumetricVectors[1], this.volumetricOrigin); +this.volumetricOrigin.scaleAdd2((1 - scale) / 2, this.volumetricVectors[2], this.volumetricOrigin); +this.volumetricVectors[0].scale(scale); +this.volumetricVectors[1].scale(scale); +this.volumetricVectors[2].scale(scale); +}, "~N"); +Clazz.defineMethod(c$, "swapXZ", +function(){ +var v = this.volumetricVectors[0]; +this.volumetricVectors[0] = this.volumetricVectors[2]; +this.volumetricVectors[2] = v; +var n = this.voxelCounts[0]; +this.voxelCounts[0] = this.voxelCounts[2]; +this.voxelCounts[2] = n; +this.params.insideOut = !this.params.insideOut; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/XmlReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/XmlReader.js new file mode 100755 index 000000000000..422a9f20d733 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/XmlReader.js @@ -0,0 +1,132 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(null, "J.jvxl.readers.XmlReader", ["JU.P3", "$.PT", "$.SB", "JU.Escape"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.br = null; +this.line = null; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "XmlReader", null); +Clazz.makeConstructor(c$, +function(br){ +this.br = br; +}, "java.io.BufferedReader"); +Clazz.defineMethod(c$, "getLine", +function(){ +return this.line; +}); +Clazz.defineMethod(c$, "toTag", +function(name){ +this.skipTo("<" + name); +if (this.line == null) return ""; +var i = this.line.indexOf("<" + name) + name.length + 1; +if (i == this.line.length) return this.line; +if (this.line.charAt(i) == ' ' || this.line.charAt(i) == '>') return this.line; +this.line = null; +return this.toTag(name); +}, "~S"); +Clazz.defineMethod(c$, "skipTag", +function(name){ +this.skipTo("" + name + ">"); +}, "~S"); +Clazz.defineMethod(c$, "getXmlData", +function(name, data, withTag, allowSelfCloseOption){ +return this.getXmlDataLF(name, data, withTag, allowSelfCloseOption, false); +}, "~S,~S,~B,~B"); +Clazz.defineMethod(c$, "getXmlDataLF", +function(name, data, withTag, allowSelfCloseOption, addLF){ +var closer = "" + name + ">"; +var tag = "<" + name; +if (data == null) { +var sb = new JU.SB(); +try { +if (this.line == null) this.line = this.br.readLine(); +while (this.line.indexOf(tag) < 0) { +this.line = this.br.readLine(); +} +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +return null; +} else { +throw e; +} +} +sb.append(this.line); +if (addLF) sb.append("\n"); +var selfClosed = false; +var pt = this.line.indexOf("/>"); +var pt1 = this.line.indexOf(">"); +if (pt1 < 0 || pt == pt1 - 1) selfClosed = allowSelfCloseOption; +while (this.line.indexOf(closer) < 0 && (!selfClosed || this.line.indexOf("/>") < 0)) { +sb.append(this.line = this.br.readLine()); +if (addLF) sb.append("\n"); +} +data = sb.toString(); +}return J.jvxl.readers.XmlReader.extractTag(data, tag, closer, withTag); +}, "~S,~S,~B,~B,~B"); +c$.extractTagOnly = Clazz.defineMethod(c$, "extractTagOnly", +function(data, tag){ +return J.jvxl.readers.XmlReader.extractTag(data, "<" + tag + ">", "" + tag + ">", false); +}, "~S,~S"); +c$.extractTag = Clazz.defineMethod(c$, "extractTag", +function(data, tag, closer, withTag){ +var pt1 = data.indexOf(tag); +if (pt1 < 0) return ""; +var pt2 = data.indexOf(closer, pt1); +if (pt2 < 0) { +pt2 = data.indexOf("/>", pt1); +closer = "/>"; +}if (pt2 < 0) return ""; +if (withTag) { +pt2 += closer.length; +return data.substring(pt1, pt2); +}var quoted = false; +for (; pt1 < pt2; pt1++) { +var ch; +if ((ch = data.charAt(pt1)) == '"') quoted = !quoted; + else if (quoted && ch == '\\') pt1++; + else if (!quoted && (ch == '>' || ch == '/')) break; +} +if (pt1 >= pt2) return ""; +while (JU.PT.isWhitespace(data.charAt(++pt1))) { +} +return J.jvxl.readers.XmlReader.unwrapCdata(data.substring(pt1, pt2)); +}, "~S,~S,~S,~B"); +c$.unwrapCdata = Clazz.defineMethod(c$, "unwrapCdata", +function(s){ +return (s.startsWith("") ? JU.PT.rep(s.substring(9, s.length - 3), "]]]]>", "]]>") : s); +}, "~S"); +c$.getXmlAttrib = Clazz.defineMethod(c$, "getXmlAttrib", +function(data, what){ +var nexta = Clazz.newIntArray (1, 0); +var pt = J.jvxl.readers.XmlReader.setNext(data, what, nexta, 1); +if (pt < 2 || (pt = J.jvxl.readers.XmlReader.setNext(data, "\"", nexta, 0)) < 2) return ""; +var pt1 = J.jvxl.readers.XmlReader.setNext(data, "\"", nexta, -1); +return (pt1 <= 0 ? "" : data.substring(pt, pt1)); +}, "~S,~S"); +Clazz.defineMethod(c$, "getXmlPoint", +function(data, key){ +var spt = J.jvxl.readers.XmlReader.getXmlAttrib(data, key).$replace('(', '{').$replace(')', '}'); +var value = JU.Escape.uP(spt); +if (Clazz.instanceOf(value,"JU.P3")) return value; +return new JU.P3(); +}, "~S,~S"); +c$.setNext = Clazz.defineMethod(c$, "setNext", +function(data, what, next, offset){ +var ipt = next[0]; +if (ipt < 0 || (ipt = data.indexOf(what, next[0])) < 0) return -1; +ipt += what.length; +next[0] = ipt + offset; +if (offset > 0 && ipt < data.length && data.charAt(ipt) != '=') return J.jvxl.readers.XmlReader.setNext(data, what, next, offset); +return next[0]; +}, "~S,~S,~A,~N"); +Clazz.defineMethod(c$, "skipTo", +function(key){ +if (this.line == null) this.line = this.br.readLine(); +while (this.line != null && this.line.indexOf(key) < 0) this.line = this.br.readLine(); + +}, "~S"); +Clazz.defineMethod(c$, "isNext", +function(name){ +if (this.line == null || this.line.indexOf("") >= 0 && this.line.indexOf("") == this.line.indexOf("<")) this.line = this.br.readLine(); +return (this.line.indexOf("<" + name) >= 0); +}, "~S"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/XplorReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/XplorReader.js new file mode 100755 index 000000000000..aa48fde51b1d --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/XplorReader.js @@ -0,0 +1,72 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.MapFileReader"], "J.jvxl.readers.XplorReader", ["JU.SB", "JU.Logger", "JV.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.nBlock = 0; +this.linePt = 2147483647; +this.nRead = 0; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "XplorReader", J.jvxl.readers.MapFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.XplorReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2MFR(sg, br); +if (this.params.thePlane == null) this.params.insideOut = !this.params.insideOut; +this.nSurfaces = 1; +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +this.jvxlFileHeaderBuffer = new JU.SB(); +var nLines = this.parseIntStr(this.getLine()); +for (var i = nLines; --i >= 0; ) { +this.line = this.br.readLine().trim(); +JU.Logger.info("XplorReader: " + this.line); +this.jvxlFileHeaderBuffer.append("# ").append(this.line).appendC('\n'); +} +this.jvxlFileHeaderBuffer.append("Xplor data\nJmol " + JV.Viewer.getJmolVersion() + '\n'); +this.na = this.parseIntStr(this.getLine()); +this.xyzStart[0] = this.parseInt(); +this.n0 = Clazz.floatToInt(this.parseInt() - this.xyzStart[0] + 1); +this.nb = this.parseInt(); +this.xyzStart[1] = this.parseInt(); +this.n1 = Clazz.floatToInt(this.parseInt() - this.xyzStart[1] + 1); +this.nc = this.parseInt(); +this.xyzStart[2] = this.parseInt(); +this.n2 = Clazz.floatToInt(this.parseInt() - this.xyzStart[2] + 1); +this.a = this.parseFloatStr(this.getLine()); +this.b = this.parseFloat(); +this.c = this.parseFloat(); +this.alpha = this.parseFloat(); +this.beta = this.parseFloat(); +this.gamma = this.parseFloat(); +this.getLine(); +this.maps = 3; +this.mapr = 2; +this.mapc = 1; +this.getVectorsAndOrigin(); +this.setCutoffAutomatic(); +this.nBlock = this.voxelCounts[2] * this.voxelCounts[1]; +}); +Clazz.defineMethod(c$, "getLine", +function(){ +this.rd(); +while (this.line != null && (this.line.length == 0 || this.line.indexOf("REMARKS") >= 0 || this.line.indexOf("XPLOR:") >= 0)) this.rd(); + +return this.line; +}); +Clazz.overrideMethod(c$, "nextVoxel", +function(){ +if (this.linePt >= this.line.length) { +this.rd(); +this.linePt = 0; +if ((this.nRead % this.nBlock) == 0) { +this.rd(); +}}if (this.line == null) return 0; +var val = this.parseFloatRange(this.line, this.linePt, this.linePt + 12); +this.linePt += 12; +this.nRead++; +return val; +}); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/XsfReader.js b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/XsfReader.js new file mode 100755 index 000000000000..1d3a1a84a6b7 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/jvxl/readers/XsfReader.js @@ -0,0 +1,62 @@ +Clazz.declarePackage("J.jvxl.readers"); +Clazz.load(["J.jvxl.readers.VolumeFileReader"], "J.jvxl.readers.XsfReader", ["JU.SB", "JU.Logger"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.isBXSF = false; +Clazz.instantialize(this, arguments);}, J.jvxl.readers, "XsfReader", J.jvxl.readers.VolumeFileReader); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.jvxl.readers.XsfReader, []); +}); +Clazz.overrideMethod(c$, "init2", +function(sg, br){ +this.init2VFR(sg, br); +}, "J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader"); +Clazz.overrideMethod(c$, "readParameters", +function(){ +this.isAngstroms = false; +this.params.blockCubeData = true; +this.jvxlFileHeaderBuffer = new JU.SB(); +this.jvxlFileHeaderBuffer.append("XsfReader file\n"); +var needCutoff = this.params.cutoffAutomatic; +this.isAngstroms = true; +var beginKey = "BEGIN_DATAGRID_3D"; +this.nSurfaces = 1; +while (this.rd() != null && this.line.indexOf(beginKey) < 0) { +JU.Logger.info(this.line); +if (this.line.indexOf("Fermi Energy:") >= 0) { +this.isBXSF = true; +beginKey = "BEGIN_BANDGRID_3D"; +if (needCutoff) { +this.params.cutoff = this.parseFloatStr(this.getTokens()[2]); +needCutoff = false; +}}continue; +} +if (needCutoff) this.params.cutoff = 0.05; +if (this.isBXSF) this.nSurfaces = this.parseIntStr(this.rd()); +this.voxelCounts[0] = this.parseIntStr(this.rd()); +this.voxelCounts[1] = this.parseInt(); +this.voxelCounts[2] = this.parseInt(); +this.volumetricOrigin.set(this.parseFloatStr(this.rd()), this.parseFloat(), this.parseFloat()); +for (var i = 0; i < 3; ++i) { +this.volumetricVectors[i].set(this.parseFloatStr(this.rd()), this.parseFloat(), this.parseFloat()); +this.volumetricVectors[i].scale(1.0 / (this.voxelCounts[i] - 1)); +} +if (this.isBXSF) { +} else { +this.swapXZ(); +}}); +Clazz.overrideMethod(c$, "gotoData", +function(n, nPoints){ +if (!this.params.blockCubeData) return; +if (n > 0) JU.Logger.info("skipping " + n + " data sets, " + nPoints + " points each"); +if (this.isBXSF) JU.Logger.info(this.rd()); +for (var i = 0; i < n; i++) this.skipData(nPoints); + +}, "~N,~N"); +Clazz.overrideMethod(c$, "skipData", +function(nPoints){ +this.skipDataVFR(nPoints); +if (this.isBXSF) JU.Logger.info(this.rd()); +}, "~N"); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/modelkit/ModelKit.js b/config/plugins/visualizations/jmol/static/j2s/J/modelkit/ModelKit.js new file mode 100755 index 000000000000..aca6f14deec3 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/modelkit/ModelKit.js @@ -0,0 +1,2797 @@ +Clazz.declarePackage("J.modelkit"); +Clazz.load(["JU.Vibration", "JU.BS", "$.P3", "J.i18n.GT"], "J.modelkit.ModelKit", ["java.util.Arrays", "$.Hashtable", "JU.AU", "$.Lst", "$.M4", "$.Measure", "$.PT", "$.Quat", "$.SB", "$.V3", "JS.SV", "JU.BSUtil", "$.Edge", "$.Elements", "$.Logger", "$.SimpleUnitCell", "JV.JC", "$.Viewer"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.vwr = null; +this.menu = null; +this.state = 0; +this.atomHoverLabel = "C"; +this.bondHoverLabel = J.i18n.GT.$("increase order"); +this.allOperators = null; +this.currentModelIndex = -1; +this.lastModelSet = null; +this.lastElementType = "C"; +this.bsHighlight = null; +this.bondIndex = -1; +this.bondAtomIndex1 = -1; +this.bondAtomIndex2 = -1; +this.bsRotateBranch = null; +this.branchAtomIndex = 0; +this.screenXY = null; +this.$isPickAtomAssignCharge = false; +this.isRotateBond = false; +this.showSymopInfo = true; +this.hasUnitCell = false; +this.alertedNoEdit = false; +this.$wasRotating = false; +this.addHydrogens = true; +this.clickToSetElement = true; +this.autoBond = false; +this.centerPoint = null; +this.pickAtomAssignType = "C"; +this.pickBondAssignType = 'p'; +this.viewOffset = null; +this.centerDistance = 0; +this.symop = null; +this.centerAtomIndex = -1; +this.secondAtomIndex = -1; +this.drawData = null; +this.drawScript = null; +this.iatom0 = 0; +this.lastCenter = "0 0 0"; +this.lastOffset = "0 0 0"; +this.a0 = null; +this.a3 = null; +this.constraint = null; +this.atomConstraints = null; +this.minBasisAtoms = null; +this.modelSyms = null; +this.minBasis = null; +this.minBasisFixed = null; +this.minBasisModelAtoms = null; +this.minBasisModel = 0; +this.minSelectionSaved = null; +this.minTempFixed = null; +this.minTempModelAtoms = null; +this.$setElementKeys = false; +this.bsElementKeyModels = null; +this.bsElementKeyModelsOFF = null; +this.haveElementKeys = false; +if (!Clazz.isClassDefined("J.modelkit.ModelKit.DrawAtomSet")) { +J.modelkit.ModelKit.$ModelKit$DrawAtomSet$ (); +} +this.drawAtomSymmetry = null; +Clazz.instantialize(this, arguments);}, J.modelkit, "ModelKit", null); +Clazz.prepareFields (c$, function(){ +this.bsHighlight = new JU.BS(); +this.screenXY = Clazz.newIntArray (2, 0); +this.bsElementKeyModels = new JU.BS(); +this.bsElementKeyModelsOFF = new JU.BS(); +}); +Clazz.makeConstructor(c$, +function(){ +}); +c$.getText = Clazz.defineMethod(c$, "getText", +function(key){ +switch (("invSter delAtom dragBon dragAto dragMin dragMol dragMMo incChar decChar rotBond bondTo0 bondTo1 bondTo2 bondTo3 incBond decBond").indexOf(key.substring(0, 7))) { +case 0: +return J.i18n.GT.$("invert ring stereochemistry"); +case 8: +return J.i18n.GT.$("delete atom"); +case 16: +return J.i18n.GT.$("drag to bond"); +case 24: +return J.i18n.GT.$("drag atom"); +case 32: +return J.i18n.GT.$("drag atom (and minimize)"); +case 40: +return J.i18n.GT.$("drag molecule (ALT to rotate)"); +case 48: +return J.i18n.GT.$("drag and minimize molecule (docking)"); +case 56: +return J.i18n.GT.$("increase charge"); +case 64: +return J.i18n.GT.$("decrease charge"); +case 72: +return J.i18n.GT.$("rotate bond"); +case 80: +return J.i18n.GT.$("delete bond"); +case 88: +return J.i18n.GT.$("single"); +case 96: +return J.i18n.GT.$("double"); +case 104: +return J.i18n.GT.$("triple"); +case 112: +return J.i18n.GT.$("increase order"); +case 120: +return J.i18n.GT.$("decrease order"); +} +return key; +}, "~S"); +c$.getTransform = Clazz.defineMethod(c$, "getTransform", +function(sym, a, b){ +var fa = JU.P3.newP(a); +sym.toFractional(fa, false); +var fb = JU.P3.newP(b); +sym.toFractional(fb, false); +return sym.getTransform(fa, fb, true); +}, "J.api.SymmetryInterface,JM.Atom,JM.Atom"); +c$.getElementKey = Clazz.defineMethod(c$, "getElementKey", +function(modelIndex){ +return "_!_elkey_" + (modelIndex < 0 ? "" : modelIndex + "_"); +}, "~N"); +c$.isTrue = Clazz.defineMethod(c$, "isTrue", +function(value){ +return (Boolean.$valueOf(value.toString()) === Boolean.TRUE); +}, "~O"); +c$.keyToElement = Clazz.defineMethod(c$, "keyToElement", +function(key){ +var ch1 = (key & 0xFF); +var ch2 = (key >> 8) & 0xFF; +var element = "" + String.fromCharCode(ch1) + (ch2 == 0 ? "" : ("" + String.fromCharCode(ch2)).toLowerCase()); +var n = JU.Elements.elementNumberFromSymbol(element, true); +return (n == 0 ? null : element); +}, "~N"); +c$.notImplemented = Clazz.defineMethod(c$, "notImplemented", +function(action){ +System.err.println("ModelKit.notImplemented(" + action + ")"); +}, "~S"); +c$.pointFromTriad = Clazz.defineMethod(c$, "pointFromTriad", +function(pos){ +var a = JU.PT.parseFloatArray(JU.PT.replaceAllCharacters(pos, "{,}", " ")); +return (a.length == 3 && !Float.isNaN(a[2]) ? JU.P3.new3(a[0], a[1], a[2]) : null); +}, "~S"); +Clazz.defineMethod(c$, "actionRotateBond", +function(deltaX, deltaY, x, y, forceFull){ +if (this.bondIndex < 0) return; +var bsBranch = this.bsRotateBranch; +var atomFix; +var atomMove; +var ms = this.vwr.ms; +var b = ms.bo[this.bondIndex]; +if (forceFull) { +bsBranch = null; +this.branchAtomIndex = -1; +}if (bsBranch == null) { +atomMove = (this.branchAtomIndex == b.atom1.i ? b.atom1 : b.atom2); +atomFix = (atomMove === b.atom1 ? b.atom2 : b.atom1); +this.vwr.undoMoveActionClear(atomFix.i, 2, true); +if (this.branchAtomIndex >= 0) bsBranch = this.vwr.getBranchBitSet(atomMove.i, atomFix.i, true); +if (bsBranch != null) for (var n = 0, i = atomFix.bonds.length; --i >= 0; ) { +if (bsBranch.get(atomFix.getBondedAtomIndex(i)) && ++n == 2) { +bsBranch = null; +break; +}} +if (bsBranch == null) { +bsBranch = ms.getMoleculeBitSetForAtom(atomFix.i); +forceFull = true; +}this.bsRotateBranch = bsBranch; +this.bondAtomIndex1 = atomFix.i; +this.bondAtomIndex2 = atomMove.i; +} else { +atomFix = ms.at[this.bondAtomIndex1]; +atomMove = ms.at[this.bondAtomIndex2]; +}if (forceFull) this.bsRotateBranch = null; +var v1 = JU.V3.new3(atomMove.sX - atomFix.sX, atomMove.sY - atomFix.sY, 0); +v1.scale(1 / v1.length()); +var v2 = JU.V3.new3(deltaX, deltaY, 0); +v1.cross(v1, v2); +var f = (v1.z > 0 ? 1 : -1); +var degrees = f * (Clazz.doubleToInt(Clazz.floatToInt(v2.length()) / 2) + 1); +if (!forceFull && this.a0 != null) { +var ang0 = JU.Measure.computeTorsion(this.a0, b.atom1, b.atom2, this.a3, true); +var ang1 = Math.round(ang0 + degrees); +degrees = ang1 - ang0; +}var bs = JU.BSUtil.copy(bsBranch); +bs.andNot(this.vwr.slm.getMotionFixedAtoms()); +this.vwr.rotateAboutPointsInternal(null, atomFix, atomMove, 0, degrees, false, bs, null, null, null, null, true); +}, "~N,~N,~N,~N,~B"); +Clazz.defineMethod(c$, "addLockedAtoms", +function(sg, bsLocked){ +if (this.vwr.am.cmi < 0 || bsLocked.cardinality() == 0) return; +var bsm = this.vwr.getThisModelAtoms(); +var i0 = bsLocked.nextSetBit(0); +if (sg == null && (sg = this.getSym(i0)) == null) return; +for (var i = bsm.nextSetBit(0); i >= 0; i = bsm.nextSetBit(i + 1)) { +if (this.setConstraint(sg, i, J.modelkit.ModelKit.GET_CREATE).type == 6) { +bsLocked.set(i); +}} +}, "J.api.SymmetryInterface,JU.BS"); +Clazz.defineMethod(c$, "checkMovedAtoms", +function(bsFixed, bsAtoms, apos0){ +var i0 = bsAtoms.nextSetBit(0); +var n = bsAtoms.cardinality(); +var apos = new Array(n); +try { +var atoms = this.vwr.ms.at; +for (var ip = 0, i = i0; i >= 0; i = bsAtoms.nextSetBit(i + 1)) { +apos[ip++] = JU.P3.newP(atoms[i]); +atoms[i].setT(apos0[i]); +} +var maxSite = 0; +for (var i = i0; i >= 0; i = bsAtoms.nextSetBit(i + 1)) { +var s = this.vwr.ms.at[i].getAtomSite(); +if (s > maxSite) maxSite = s; +} +var sites = Clazz.newIntArray (maxSite, 0); +var p1 = new JU.P3(); +var bsModelAtoms = this.vwr.getModelUndeletedAtomsBitSet(this.vwr.ms.at[i0].mi); +var bsMoved = new JU.BS(); +for (var ip = 0, i = i0; i >= 0; i = bsAtoms.nextSetBit(i + 1), ip++) { +p1.setT(apos[ip]); +var s = this.vwr.ms.at[i].getAtomSite() - 1; +if (sites[s] == 0) { +sites[s] = i + 1; +bsMoved = this.moveConstrained(i, bsFixed, bsModelAtoms, p1, true, false, bsMoved); +if (bsMoved == null) { +n = 0; +break; +}}} +return (n != 0 && this.checkAtomPositions(apos0, apos, bsAtoms) ? n : 0); +} finally { +if (n == 0) { +this.vwr.ms.restoreAtomPositions(apos0); +bsAtoms.clearAll(); +} else { +this.updateDrawAtomSymmetry("atomsMoved", bsAtoms); +}} +}, "JU.BS,JU.BS,~A"); +Clazz.defineMethod(c$, "checkOption", +function(type, key){ +var check = null; +switch ((type).charCodeAt(0)) { +case 77: +check = ";view;edit;molecular;"; +break; +case 83: +check = ";none;applylocal;retainlocal;applyfull;"; +break; +case 85: +check = ";packed;extend;"; +break; +case 66: +check = ";key;elementkey;autobond;hidden;showsymopinfo;clicktosetelement;addhydrogen;addhydrogens;"; +break; +} +return (check != null && JU.PT.isOneOf(key.toLowerCase(), check)); +}, "~S,~S"); +Clazz.defineMethod(c$, "clearAtomConstraints", +function(){ +this.modelSyms = null; +this.minBasisAtoms = null; +if (this.atomConstraints != null) { +for (var i = this.atomConstraints.length; --i >= 0; ) this.atomConstraints[i] = null; + +}}); +Clazz.defineMethod(c$, "clickAssignAtom", +function(atomIndex, element, ptNew){ +var n = this.addAtomType(element, Clazz.newArray(-1, [(ptNew == null ? null : ptNew)]), JU.BSUtil.newAndSetBit(atomIndex), "", null, "click"); +if (n > 0) this.vwr.setPickingMode("dragAtom", 0); +}, "~N,~S,JU.P3"); +Clazz.defineMethod(c$, "cmdAssignAddAtoms", +function(type, pts, bsAtoms, packing, cmd){ +if (type.startsWith("_")) type = type.substring(1); +return Math.abs(this.addAtomType(type, pts, bsAtoms, packing, null, cmd)); +}, "~S,~A,JU.BS,~S,~S"); +Clazz.defineMethod(c$, "cmdAssignAtom", +function(bs, pt, type, cmd){ +if (pt != null && bs != null && bs.cardinality() > 1) bs = JU.BSUtil.newAndSetBit(bs.nextSetBit(0)); +if (type.startsWith("_")) type = type.substring(1); +this.assignAtomNoAddedSymmetry(pt, -1, bs, type, (pt != null), cmd, 0); +}, "JU.BS,JU.P3,~S,~S"); +Clazz.defineMethod(c$, "cmdAssignBond", +function(bondIndex, type, cmd){ +this.assignBondAndType(bondIndex, this.getBondOrder(type, this.vwr.ms.bo[bondIndex]), type, cmd); +}, "~N,~S,~S"); +Clazz.defineMethod(c$, "cmdAssignConnect", +function(index, index2, type, cmd){ +var atoms = this.vwr.ms.at; +var a; +var b; +if (index < 0 || index2 < 0 || index >= atoms.length || index2 >= atoms.length || (a = atoms[index]) == null || (b = atoms[index2]) == null) return; +var state = this.getMKState(); +try { +var bond = null; +if (type != '1') { +var bs = new JU.BS(); +bs.set(index); +bs.set(index2); +bs = this.vwr.getBondsForSelectedAtoms(bs); +bond = this.vwr.ms.bo[bs.nextSetBit(0)]; +}var bondOrder = this.getBondOrder(type, bond); +var bs1 = this.vwr.ms.getSymmetryEquivAtoms(JU.BSUtil.newAndSetBit(index), null, null); +var bs2 = this.vwr.ms.getSymmetryEquivAtoms(JU.BSUtil.newAndSetBit(index2), null, null); +this.connectAtoms(a.distance(b), bondOrder, bs1, bs2); +if (this.vwr.getOperativeSymmetry() == null) { +bond = a.getBond(b); +if (bond != null) { +bs1.or(bs2); +this.assignBond(bond.index, 1, bs1); +}}} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +e.printStackTrace(); +} else { +throw e; +} +} finally { +this.setMKState(state); +} +}, "~N,~N,~S,~S"); +Clazz.defineMethod(c$, "cmdAssignDeleteAtoms", +function(bs){ +this.clearAtomConstraints(); +bs.and(this.vwr.getThisModelAtoms()); +bs = this.vwr.ms.getSymmetryEquivAtoms(bs, null, null); +if (!bs.isEmpty()) { +this.vwr.deleteAtoms(bs, false); +}return bs.cardinality(); +}, "JU.BS"); +Clazz.defineMethod(c$, "cmdAssignMoveAtoms", +function(bsSelected, iatom, p, pts, allowProjection, isMolecule){ +var sym = this.getSym(iatom); +var n; +if (sym != null) { +if (this.addHydrogens) this.vwr.ms.addConnectedHAtoms(this.vwr.ms.at[iatom], bsSelected); +n = this.assignMoveAtoms(sym, bsSelected, null, null, iatom, p, pts, allowProjection, isMolecule); +} else { +n = this.vwr.moveAtomWithHydrogens(iatom, this.addHydrogens ? 1 : 0, 0, 0, p, null); +}if (n == 0) this.vwr.showString("could not move atoms!", false); +return n; +}, "JU.BS,~N,JU.P3,~A,~B,~B"); +Clazz.defineMethod(c$, "cmdAssignSpaceGroup", +function(bs, name, paramsOrUC, isPacked, doDraw, cmd){ +var sym0 = this.vwr.getCurrentUnitCell(); +var sym = this.vwr.getOperativeSymmetry(); +if (sym0 != null && sym !== sym0) sym.getUnitCell(sym0.getV0abc(null, null), false, "modelkit"); +var sb = new JU.SB(); +var ret = this.assignSpaceGroup(sym, null, bs, paramsOrUC, JU.PT.split(name, ">"), 0, null, null, sb); +if (ret.endsWith("!")) return ret; +if (isPacked) { +var n; +if (doDraw) { +n = this.cmdAssignAddAtoms("N:G", null, null, "packed", cmd); +} else { +var transform = ret; +var bsModelAtoms = this.vwr.getThisModelAtoms(); +n = this.cmdAssignSpaceGroupPacked(bsModelAtoms, transform, cmd); +}sb.append("\n").append(J.i18n.GT.i(J.i18n.GT.$("{0} atoms added"), n)); +}var msg = sb.toString(); +var isError = msg.endsWith("!"); +if (doDraw && !isError) { +var s = this.drawSymmetry("sym", false, -1, null, 2147483647, null, null, null, 0, -2, 0, null, true); +this.appRunScript(s); +}return msg; +}, "JU.BS,~S,~O,~B,~B,~S"); +Clazz.defineMethod(c$, "cmdAssignSpaceGroupPacked", +function(bsAtoms, transform, cmd){ +var sym = this.vwr.getOperativeSymmetry(); +if (sym == null) return 0; +var opsCtr = sym.getSpaceGroupInfoObj("opsCtr", transform, false, false); +var n0 = bsAtoms.cardinality(); +this.addAtoms(null, null, bsAtoms, "packed", opsCtr, cmd); +bsAtoms = this.vwr.getThisModelAtoms(); +this.vwr.ms.setSpaceGroup(this.vwr.am.cmi, sym, new JU.BS()); +return bsAtoms.cardinality() - n0; +}, "JU.BS,~S,~S"); +Clazz.defineMethod(c$, "cmdMinimize", +function(eval, bsBasis, steps, crit, rangeFixed, flags){ +var wasAppend = this.vwr.getBoolean(603979792); +try { +this.vwr.setBooleanProperty("appendNew", true); +this.minimizeXtal(eval, bsBasis, steps, crit, rangeFixed, flags); +} finally { +this.vwr.setBooleanProperty("appendNew", wasAppend); +} +}, "J.api.JmolScriptEvaluator,JU.BS,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "cmdRotateAtoms", +function(bsAtoms, points, endDegrees){ +return this.rotateAtoms(bsAtoms, points, endDegrees); +}, "JU.BS,~A,~N"); +Clazz.defineMethod(c$, "dispose", +function(){ +this.menu.jpiDispose(); +this.menu.modelkit = null; +this.menu = null; +this.vwr = null; +}); +Clazz.defineMethod(c$, "getActiveMenu", +function(){ +return this.menu.activeMenu; +}); +Clazz.defineMethod(c$, "getDefaultModel", +function(){ +return (this.addHydrogens ? "5\n\nC 0 0 0\nH .63 .63 .63\nH -.63 -.63 .63\nH -.63 .63 -.63\nH .63 -.63 -.63" : "1\n\nC 0 0 0\n"); +}); +Clazz.defineMethod(c$, "getProperty", +function(name){ +name = name.toLowerCase().intern(); +if (name === "exists") return Boolean.TRUE; +if (name === "constraint") { +return this.constraint; +}if (name === "ismolecular") { +return Boolean.$valueOf(this.getMKState() == 0); +}if (name === "key" || name === "elementkey") { +return Boolean.$valueOf(this.isElementKeyOn(this.vwr.am.cmi)); +}if (name === "minimizing") return Boolean.$valueOf(this.minBasis != null); +if (name === "alloperators") { +return this.allOperators; +}if (name === "data") { +return this.getinfo(); +}return this.setProperty(name, null); +}, "~S"); +Clazz.defineMethod(c$, "getRotateBondIndex", +function(){ +return (this.getMKState() == 0 && this.isRotateBond ? this.bondIndex : -1); +}); +Clazz.defineMethod(c$, "getSym", +function(iatom){ +var modelIndex = this.vwr.ms.at[iatom].mi; +if (this.modelSyms == null || modelIndex >= this.modelSyms.length) { +this.modelSyms = new Array(this.vwr.ms.mc); +for (var imodel = this.modelSyms.length; --imodel >= 0; ) { +var sym = this.vwr.ms.getUnitCell(imodel); +if (sym == null || sym.getSymmetryOperations() != null) this.modelSyms[imodel] = sym; +} +}return (iatom < 0 ? null : this.modelSyms[modelIndex]); +}, "~N"); +Clazz.defineMethod(c$, "handleAssignNew", +function(pressed, dragged, mp, dragAtomIndex, key){ +var inRange = pressed.inRange(10, dragged.x, dragged.y); +if (mp != null && this.handleAtomDragging(mp.countPlusIndices)) return true; +var atomType = (key < 0 ? this.pickAtomAssignType : J.modelkit.ModelKit.keyToElement(key)); +if (atomType == null) return false; +var x = (inRange ? pressed.x : dragged.x); +var y = (inRange ? pressed.y : dragged.y); +if (this.vwr.antialiased) { +x <<= 1; +y <<= 1; +}return this.handleAtomOrBondPicked(x, y, mp, dragAtomIndex, atomType, inRange); +}, "JV.MouseState,JV.MouseState,JM.MeasurementPending,~N,~N"); +Clazz.defineMethod(c$, "hasConstraint", +function(iatom, ignoreGeneral, addNew){ +var c = this.setConstraint(this.getSym(iatom), iatom, addNew ? J.modelkit.ModelKit.GET_CREATE : J.modelkit.ModelKit.GET); +return (c != null && (!ignoreGeneral || c.type != 7)); +}, "~N,~B,~B"); +Clazz.defineMethod(c$, "initializeForModel", +function(isZap){ +this.resetBondFields(); +this.allOperators = null; +this.currentModelIndex = -999; +this.iatom0 = 0; +this.centerAtomIndex = this.secondAtomIndex = -1; +this.centerPoint = null; +this.symop = null; +this.setDefaultState(0); +if (isZap) { +if (this.$setElementKeys) { +this.updateModelElementKey(this.vwr.am.cmi, true); +}this.bsElementKeyModels.clearAll(); +this.bsElementKeyModelsOFF.clearAll(); +}}, "~B"); +Clazz.defineMethod(c$, "isHidden", +function(){ +return this.menu.hidden; +}); +Clazz.defineMethod(c$, "isPickAtomAssignCharge", +function(){ +return this.$isPickAtomAssignCharge; +}); +Clazz.defineMethod(c$, "minimizeEnd", +function(bsBasis2, isEnd){ +this.minimizeXtalEnd(bsBasis2, isEnd); +this.vwr.refresh(1, "modelkit minimize"); +}, "JU.BS,~B"); +Clazz.defineMethod(c$, "moveMinConstrained", +function(iatom, p, bsAtoms){ +var bsMoved = this.moveConstrained(iatom, null, bsAtoms, p, true, true, null); +return (bsMoved == null ? 0 : bsMoved.cardinality()); +}, "~N,JU.P3,JU.BS"); +Clazz.defineMethod(c$, "setBondMeasure", +function(bi, mp){ +if (this.branchAtomIndex < 0) return null; +var b = this.vwr.ms.bo[bi]; +var a1 = b.atom1; +var a2 = b.atom2; +this.a0 = this.a3 = null; +if (a1.getCovalentBondCount() == 1 || a2.getCovalentBondCount() == 1) return null; +mp.addPoint((this.a0 = J.modelkit.ModelKit.getNearestBondedAtom(a1, a2)).i, null, true); +mp.addPoint(a1.i, null, true); +mp.addPoint(a2.i, null, true); +mp.addPoint((this.a3 = J.modelkit.ModelKit.getNearestBondedAtom(a2, a1)).i, null, true); +mp.mad = 50; +mp.inFront = true; +return mp; +}, "~N,JM.MeasurementPending"); +Clazz.defineMethod(c$, "setMenu", +function(menu){ +this.menu = menu; +this.vwr = menu.vwr; +menu.modelkit = this; +this.initializeForModel(false); +}, "J.modelkit.ModelKitPopup"); +Clazz.defineMethod(c$, "setProperty", +function(key, value){ +try { +if (this.vwr == null) return null; +key = key.toLowerCase().intern(); +if (key === "hoverlabel") { +return this.getHoverLabel((value).intValue()); +}if (key === "initializemodel") { +this.initializeForModel(true); +return null; +}if (key === "atomset") { +this.addAtomSet(value); +return null; +}if (key === "atomsMoved") { +if (this.drawAtomSymmetry != null) { +this.updateDrawAtomSymmetry(key, (value)[0]); +}return null; +}if (key === "updatemodelkeys") { +if (this.haveElementKeys) this.updateModelElementKeys(value == null ? null : (value)[1], true); +if (this.drawAtomSymmetry != null && value != null) { +this.updateDrawAtomSymmetry("atomsDeleted", (value)[0]); +}return null; +}if (key === "updatekeysfromstate") { +this.updateElementKeyFromStateScript(); +return null; +}if (key === "updateatomkeys") { +var bsAtoms = value; +this.updateElementKey(bsAtoms); +return null; +}if (key === "setelementkey") { +this.setElementKeys(J.modelkit.ModelKit.isTrue(value)); +return null; +}if (key === "frameresized") { +this.clearElementKey(-2); +this.updateModelElementKeys(null, true); +return null; +}if (key === "key" || key === "elementkey") { +var mi = this.vwr.am.cmi; +var isOn = J.modelkit.ModelKit.isTrue(value); +this.bsElementKeyModelsOFF.setBitTo(mi, !isOn); +this.bsElementKeyModels.setBitTo(mi, false); +this.setElementKey(mi, isOn); +return isOn ? "true" : "false"; +}if (key === "branchatomclicked") { +if (this.isRotateBond && !this.vwr.acm.isHoverable()) this.setBranchAtom((value).intValue(), true); +return null; +}if (key === "branchatomdragged") { +if (this.isRotateBond) this.setBranchAtom((value).intValue(), true); +return null; +}if (key === "hidemenu") { +this.menu.hidePopup(); +return null; +}if (key === "constraint") { +this.constraint = null; +this.clearAtomConstraints(); +var o = value; +if (o != null) { +var v1 = o[0]; +var v2 = o[1]; +var plane = o[2]; +if (v1 != null && v2 != null) { +this.constraint = new J.modelkit.ModelKit.Constraint(null, 4, Clazz.newArray(-1, [v1, v2])); +} else if (plane != null) { +this.constraint = new J.modelkit.ModelKit.Constraint(null, 5, Clazz.newArray(-1, [plane])); +} else if (v1 != null) this.constraint = new J.modelkit.ModelKit.Constraint(null, 6, null); +}return null; +}if (key === "reset") { +return null; +}if (key === "atompickingmode") { +if (JU.PT.isOneOf(value, ";identify;off;")) { +this.exitBondRotation(null); +this.vwr.setBooleanProperty("bondPicking", false); +this.vwr.acm.exitMeasurementMode("modelkit"); +}if ("dragatom".equals(value)) { +this.setHoverLabel("atomMenu", J.modelkit.ModelKit.getText("dragAtom")); +}return null; +}if (key === "bondpickingmode") { +if (value.equals("deletebond")) { +this.exitBondRotation(J.modelkit.ModelKit.getText("bondTo0")); +} else if (value.equals("identifybond")) { +this.exitBondRotation(""); +}return null; +}if (key === "rotateBond") { +var i = (value).intValue(); +if (i != this.bondAtomIndex2) this.bondAtomIndex1 = i; +this.bsRotateBranch = null; +return null; +}if (key === "bondindex") { +if (value != null) { +this.setBondIndex((value).intValue(), false); +}return (this.bondIndex < 0 ? null : Integer.$valueOf(this.bondIndex)); +}if (key === "rotatebondindex") { +if (value != null) { +this.setBondIndex((value).intValue(), true); +}return (this.bondIndex < 0 ? null : Integer.$valueOf(this.bondIndex)); +}if (key === "highlight") { +this.bsHighlight.clearAll(); +if (value != null) this.bsHighlight.or(value); +return null; +}if (key === "mode") { +var isEdit = ("edit".equals(value)); +this.setMKState("view".equals(value) ? 1 : isEdit ? 2 : 0); +if (isEdit) this.addHydrogens = false; +return null; +}if (key === "symmetry") { +this.setDefaultState(2); +key = (value).toLowerCase().intern(); +this.setSymEdit(key === "applylocal" ? 32 : key === "retainlocal" ? 64 : key === "applyfull" ? 128 : 0); +this.showXtalSymmetry(); +return null; +}if (key === "unitcell") { +var isPacked = "packed".equals(value); +this.setUnitCell(isPacked ? 0 : 256); +this.viewOffset = (isPacked ? J.modelkit.ModelKit.Pt000 : null); +return null; +}if (key === "center") { +this.setDefaultState(1); +this.centerPoint = value; +this.lastCenter = this.centerPoint.x + " " + this.centerPoint.y + " " + this.centerPoint.z; +this.centerAtomIndex = (Clazz.instanceOf(this.centerPoint,"JM.Atom") ? (this.centerPoint).i : -1); +this.secondAtomIndex = -1; +this.clickProcessAtom(this.centerAtomIndex); +return null; +}if (key === "assignBond") { +this.cmdAssignBond((value).intValue(), this.pickBondAssignType, "click"); +return null; +}if (key === "addhydrogen" || key === "addhydrogens") { +if (value != null) this.addHydrogens = J.modelkit.ModelKit.isTrue(value); +return Boolean.$valueOf(this.addHydrogens); +}if (key === "autobond") { +if (value != null) this.autoBond = J.modelkit.ModelKit.isTrue(value); +return Boolean.$valueOf(this.autoBond); +}if (key === "clicktosetelement") { +if (value != null) this.clickToSetElement = J.modelkit.ModelKit.isTrue(value); +return Boolean.$valueOf(this.clickToSetElement); +}if (key === "hidden") { +if (value != null) { +this.menu.hidden = J.modelkit.ModelKit.isTrue(value); +if (this.menu.hidden) this.menu.hidePopup(); +this.vwr.setBooleanProperty("modelkitMode", true); +}return Boolean.$valueOf(this.menu.hidden); +}if (key === "showsymopinfo") { +if (value != null) this.showSymopInfo = J.modelkit.ModelKit.isTrue(value); +return Boolean.$valueOf(this.showSymopInfo); +}if (key === "symop") { +this.setDefaultState(1); +if (value != null) { +if (key === "hoverlabel") { +return this.getHoverLabel((value).intValue()); +}this.symop = value; +this.showSymop(this.symop); +}return this.symop; +}if (key === "atomtype") { +this.$wasRotating = this.isRotateBond; +this.isRotateBond = false; +if (value != null) { +this.pickAtomAssignType = value; +this.$isPickAtomAssignCharge = (this.pickAtomAssignType.equalsIgnoreCase("pl") || this.pickAtomAssignType.equalsIgnoreCase("mi")); +if (this.$isPickAtomAssignCharge) { +this.setHoverLabel("atomMenu", J.modelkit.ModelKit.getText(this.pickAtomAssignType.equalsIgnoreCase("mi") ? "decCharge" : "incCharge")); +} else if ("X".equals(this.pickAtomAssignType)) { +this.setHoverLabel("atomMenu", J.modelkit.ModelKit.getText("delAtom")); +} else if (this.pickAtomAssignType.equals("Xx")) { +this.setHoverLabel("atomMenu", J.modelkit.ModelKit.getText("dragBond")); +} else { +this.setHoverLabel("atomMenu", "Click or click+drag to bond or for a new " + this.pickAtomAssignType); +this.lastElementType = this.pickAtomAssignType; +}}return this.pickAtomAssignType; +}if (key === "bondtype") { +if (value != null) { +var s = (value).substring(0, 1).toLowerCase(); +if (" 0123456pm".indexOf(s) > 0) { +this.pickBondAssignType = s.charAt(0); +this.setHoverLabel("bondMenu", J.modelkit.ModelKit.getText(this.pickBondAssignType == 'm' ? "decBond" : this.pickBondAssignType == 'p' ? "incBond" : "bondTo" + s)); +}this.isRotateBond = false; +}return "" + this.pickBondAssignType; +}if (key === "offset") { +if (value === "none") { +this.viewOffset = null; +} else if (value != null) { +this.viewOffset = (Clazz.instanceOf(value,"JU.P3") ? value : J.modelkit.ModelKit.pointFromTriad(value.toString())); +if (this.viewOffset != null) this.setSymViewState(8); +}this.showXtalSymmetry(); +return this.viewOffset; +}if (key === "screenxy") { +if (value != null) { +this.screenXY = value; +this.vwr.acm.exitMeasurementMode("modelkit"); +}return this.screenXY; +}if (key === "invariant") { +var iatom = (Clazz.instanceOf(value,"JU.BS") ? (value).nextSetBit(0) : -1); +var atom = this.vwr.ms.getAtom(iatom); +return (atom == null ? null : this.vwr.getSymmetryInfo(iatom, null, -1, null, atom, atom, 1275068418, null, 0, 0, 0, null)); +}if (key === "distance") { +this.setDefaultState(2); +var d = (value == null ? NaN : Clazz.instanceOf(value, Float) ? (value).floatValue() : JU.PT.parseFloat(value)); +if (!Float.isNaN(d)) { +J.modelkit.ModelKit.notImplemented("setProperty: distance"); +this.centerDistance = d; +}return Float.$valueOf(this.centerDistance); +}if (key === "addconstraint") { +J.modelkit.ModelKit.notImplemented("setProperty: addConstraint"); +return null; +}if (key === "removeconstraint") { +J.modelkit.ModelKit.notImplemented("setProperty: removeConstraint"); +return null; +}if (key === "removeallconstraints") { +J.modelkit.ModelKit.notImplemented("setProperty: removeAllConstraints"); +return null; +}if (key === "vibration") { +J.modelkit.ModelKit.WyckoffModulation.setVibrationMode(this, value); +return null; +}System.err.println("ModelKit.setProperty? " + key + " " + value); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +return "?"; +} else { +throw e; +} +} +return null; +}, "~S,~O"); +Clazz.defineMethod(c$, "showMenu", +function(x, y){ +this.menu.jpiShow(x, y); +}, "~N,~N"); +Clazz.defineMethod(c$, "updateMenu", +function(){ +this.menu.jpiUpdateComputedMenus(); +}); +Clazz.defineMethod(c$, "wasRotating", +function(){ +var b = this.$wasRotating; +this.$wasRotating = false; +return b; +}); +Clazz.defineMethod(c$, "checkNewModel", +function(){ +var isNew = false; +if (this.vwr.ms !== this.lastModelSet) { +this.lastModelSet = this.vwr.ms; +isNew = true; +}this.currentModelIndex = Math.max(this.vwr.am.cmi, 0); +this.iatom0 = this.vwr.ms.am[this.currentModelIndex].firstAtomIndex; +return isNew; +}); +Clazz.defineMethod(c$, "clickProcessXtal", +function(id, action){ +if (this.processSymop(id, false)) return; +action = action.intern(); +if (action.startsWith("mkmode_")) { +if (!this.alertedNoEdit && action === "mkmode_edit") { +this.alertedNoEdit = true; +this.vwr.alert("ModelKit xtal edit has not been implemented"); +return; +}this.clickProcessMode(action); +} else if (action.startsWith("mksel_")) { +this.clickProcessSel(action); +} else if (action.startsWith("mkselop_")) { +while (action != null) action = this.clickProcessSelOp(action); + +} else if (action.startsWith("mksymmetry_")) { +this.clickProcessSym(action); +} else if (action.startsWith("mkunitcell_")) { +this.clickProcessUC(action); +} else { +J.modelkit.ModelKit.notImplemented("XTAL click " + action); +}this.menu.updateAllXtalMenuOptions(); +}, "~S,~S"); +Clazz.defineMethod(c$, "exitBondRotation", +function(text){ +this.$wasRotating = this.isRotateBond; +this.isRotateBond = false; +if (text != null) this.bondHoverLabel = text; +this.vwr.highlight(null); +}, "~S"); +Clazz.defineMethod(c$, "getAllOperators", +function(){ +if (this.allOperators != null) return this.allOperators; +var data = this.runScriptBuffered("show symop"); +this.allOperators = JU.PT.split(data.trim().$replace('\t', ' '), "\n"); +return this.allOperators; +}); +Clazz.defineMethod(c$, "getBasisAtom", +function(iatom){ +if (this.minBasisAtoms == null) { +this.minBasisAtoms = new Array(this.vwr.ms.ac + 10); +}if (this.minBasisAtoms.length < iatom + 10) { +var a = new Array(this.vwr.ms.ac + 10); +System.arraycopy(this.minBasisAtoms, 0, a, 0, this.minBasisAtoms.length); +this.minBasisAtoms = a; +}var b = this.minBasisAtoms[iatom]; +return (b == null ? (this.minBasisAtoms[iatom] = this.vwr.ms.getBasisAtom(iatom, false)) : b); +}, "~N"); +Clazz.defineMethod(c$, "getCenterText", +function(){ +return (this.centerAtomIndex < 0 && this.centerPoint == null ? null : this.centerAtomIndex >= 0 ? this.vwr.getAtomInfo(this.centerAtomIndex) : this.centerPoint.toString()); +}); +Clazz.defineMethod(c$, "getElementFromUser", +function(){ +var element = this.promptUser(J.i18n.GT.$("Element?"), ""); +return (element == null || JU.Elements.elementNumberFromSymbol(element, true) == 0 ? null : element); +}); +Clazz.defineMethod(c$, "getMKState", +function(){ +return this.state & 3; +}); +Clazz.defineMethod(c$, "getSymEditState", +function(){ +return this.state & 224; +}); +Clazz.defineMethod(c$, "getSymopText", +function(){ +return (this.symop == null || this.allOperators == null ? null : Clazz.instanceOf(this.symop, Integer) ? this.allOperators[(this.symop).intValue() - 1] : this.symop.toString()); +}); +Clazz.defineMethod(c$, "getSymViewState", +function(){ +return this.state & 28; +}); +Clazz.defineMethod(c$, "getUnitCellState", +function(){ +return this.state & 1792; +}); +Clazz.defineMethod(c$, "isXtalState", +function(){ +return ((this.state & 3) != 0); +}); +Clazz.defineMethod(c$, "processMKPropertyItem", +function(name, TF){ +name = name.substring(2); +var pt = name.indexOf("_"); +if (pt > 0) { +this.setProperty(name.substring(0, pt), name.substring(pt + 1)); +} else { +this.setProperty(name, Boolean.$valueOf(TF)); +}}, "~S,~B"); +Clazz.defineMethod(c$, "processSymop", +function(id, isFocus){ +var pt = id.indexOf(".mkop_"); +if (pt >= 0) { +var op = this.symop; +this.symop = Integer.$valueOf(id.substring(pt + 6)); +this.showSymop(this.symop); +if (isFocus) this.symop = op; +return true; +}return false; +}, "~S,~B"); +Clazz.defineMethod(c$, "resetAtomPickType", +function(){ +this.setProperty("atomtype", this.lastElementType); +}); +Clazz.defineMethod(c$, "setConstraint", +function(sym, ia, mode){ +if (ia < 0) return null; +var a = this.getBasisAtom(ia); +var iatom = a.i; +var ac = (this.atomConstraints != null && iatom < this.atomConstraints.length ? this.atomConstraints[iatom] : null); +if (ac != null || mode != J.modelkit.ModelKit.GET_CREATE) { +if (ac != null && mode == J.modelkit.ModelKit.GET_DELETE) { +this.atomConstraints[iatom] = null; +}return ac; +}if (sym == null) return this.addConstraint(iatom, new J.modelkit.ModelKit.Constraint(a, 0, null)); +var ops = sym.getInvariantSymops(a, null); +if (JU.Logger.debugging) System.out.println("MK.getConstraint atomIndex=" + iatom + " symops=" + java.util.Arrays.toString(ops)); +if (ops.length == 0) return this.addConstraint(iatom, new J.modelkit.ModelKit.Constraint(a, 7, null)); +var plane1 = null; +var line1 = null; +for (var i = ops.length; --i >= 0; ) { +var line2 = null; +var c = sym.getSymmetryInfoAtom(this.vwr.ms, iatom, null, ops[i], null, a, null, "invariant", 1275068418, 0, -1, 0, null); +if ((typeof(c)=='string')) { +continue; +} else if (Clazz.instanceOf(c,"JU.P4")) { +var plane = c; +if (plane1 == null) { +plane1 = plane; +continue; +}var line = JU.Measure.getIntersectionPP(plane1, plane); +if (line == null || line.size() == 0) { +return J.modelkit.ModelKit.locked; +}line2 = Clazz.newArray(-1, [line.get(0), line.get(1)]); +} else if (Clazz.instanceOf(c,"JU.P3")) { +return J.modelkit.ModelKit.locked; +} else { +line2 = c; +}if (line2 != null) { +if (line1 == null) { +line1 = line2; +} else { +var v1 = line1[1]; +if (Math.abs(v1.dot(line2[1])) < 0.999) return J.modelkit.ModelKit.locked; +}if (plane1 != null) { +if (Math.abs(plane1.dot(line2[1])) > 0.001) return J.modelkit.ModelKit.locked; +}}} +if (line1 != null) { +line1[0] = JU.P3.newP(a); +}return this.addConstraint(iatom, line1 != null ? new J.modelkit.ModelKit.Constraint(a, 4, line1) : plane1 != null ? new J.modelkit.ModelKit.Constraint(a, 5, Clazz.newArray(-1, [plane1])) : new J.modelkit.ModelKit.Constraint(a, 7, null)); +}, "J.api.SymmetryInterface,~N,~N"); +Clazz.defineMethod(c$, "setHasUnitCell", +function(){ +return this.hasUnitCell = (this.vwr.getOperativeSymmetry() != null); +}); +Clazz.defineMethod(c$, "setHoverLabel", +function(mode, text){ +if (text == null) return; +if (mode === "bondMenu") { +this.bondHoverLabel = text; +} else if (mode === "atomMenu") { +this.atomHoverLabel = text; +} else if (mode === "xtalMenu") { +this.atomHoverLabel = text; +}}, "~S,~S"); +Clazz.defineMethod(c$, "setMKState", +function(bits){ +this.state = (this.state & -4) | (this.hasUnitCell ? bits : 0); +}, "~N"); +Clazz.defineMethod(c$, "addAtomType", +function(type, pts, bsAtoms, packing, opsCtr, cmd){ +var sym = this.vwr.getOperativeSymmetry(); +var ipt = type.indexOf(":"); +var wyckoff = (ipt > 0 && ipt == type.length - 2 ? type.substring(ipt + 1) : null); +if (wyckoff != null) { +type = type.substring(0, ipt); +if (sym != null) { +var o = sym.getWyckoffPosition(this.vwr, null, wyckoff); +if (!(Clazz.instanceOf(o,"JU.P3"))) return 0; +pts = Clazz.newArray(-1, [o]); +}}return this.addAtoms(type, pts, bsAtoms, packing, opsCtr, cmd); +}, "~S,~A,JU.BS,~S,~A,~S"); +Clazz.defineMethod(c$, "addAtoms", +function(type, pts, bsAtoms, packing, opsCtr, cmd){ +try { +this.vwr.pushHoldRepaintWhy("modelkit"); +var sym = this.vwr.getOperativeSymmetry(); +if (type != null) { +var ipt = type.indexOf(":"); +var wyckoff = (ipt > 0 && ipt == type.length - 2 ? type.substring(ipt + 1) : null); +if (wyckoff != null) { +type = type.substring(0, ipt); +if (sym != null) { +var o = sym.getWyckoffPosition(this.vwr, null, wyckoff); +if (!(Clazz.instanceOf(o,"JU.P3"))) return 0; +pts = Clazz.newArray(-1, [o]); +}}}var isPoint = (bsAtoms == null); +var atomIndex = (isPoint ? -1 : bsAtoms.nextSetBit(0)); +if (!isPoint && atomIndex < 0 || sym == null && type == null) return 0; +var n = 0; +if (sym == null) { +if (isPoint) { +for (var i = 0; i < pts.length; i++) this.assignAtomNoAddedSymmetry(pts[i], -1, null, type, true, cmd, -1); + +n = -pts.length; +} else { +this.assignAtomNoAddedSymmetry(pts[0], atomIndex, null, type, true, cmd, -1); +n = -1; +}} else { +n = this.addAtomsWithSymmetry(sym, bsAtoms, type, atomIndex, isPoint, pts, packing, opsCtr); +}return n; +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +e.printStackTrace(); +return 0; +} else { +throw e; +} +} finally { +this.vwr.popHoldRepaint("modelkit"); +} +}, "~S,~A,JU.BS,~S,~A,~S"); +Clazz.defineMethod(c$, "addAtomsWithSymmetry", +function(sym, bsAtoms, type, atomIndex, isPoint, pts, packing, opsCtr){ +var bsM = this.vwr.getThisModelAtoms(); +var n = bsM.cardinality(); +if (n == 0) packing = "zapped;" + packing; +var stype = "" + type; +var points = new JU.Lst(); +var site = 0; +var pf = null; +if (pts != null && pts.length == 1 && pts[0] != null) { +pf = JU.P3.newP(pts[0]); +sym.toFractional(pf, false); +isPoint = true; +}for (var i = bsM.nextSetBit(0); i >= 0; i = bsM.nextSetBit(i + 1)) { +var p = JU.P3.newP(this.vwr.ms.at[i]); +sym.toFractional(p, false); +if (pf != null && pf.distanceSquared(p) < 1.96E-6) { +site = this.vwr.ms.at[i].getAtomSite(); +if (type == null || pts == null) type = this.vwr.ms.at[i].getElementSymbolIso(true); +}points.addLast(p); +} +var nInitial = points.size(); +packing = "fromfractional;tocartesian;" + packing; +if (isPoint) { +var bsEquiv = (bsAtoms == null ? null : this.vwr.ms.getSymmetryEquivAtoms(bsAtoms, null, null)); +for (var i = 0; i < pts.length; i++) { +this.assignAtoms(JU.P3.newP(pts[i]), atomIndex, bsEquiv, stype, true, null, false, site, sym, points, packing, null); +} +} else { +var sites = new JU.BS(); +for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) { +var a = this.vwr.ms.at[i]; +site = a.getAtomSite(); +if (sites.get(site)) continue; +sites.set(site); +stype = (type == null ? a.getElementSymbolIso(true) : stype); +this.assignAtoms(JU.P3.newP(a), -1, null, stype, false, null, false, site, sym, points, packing, opsCtr); +if (opsCtr == null) { +for (var j = points.size(); --j >= nInitial; ) points.removeItemAt(j); + +} else { +for (var j = points.size(); --j >= nInitial; ) { +var p = points.get(j); +sym.toFractional(p, false); +} +nInitial = points.size(); +}} +}return this.vwr.getThisModelAtoms().cardinality() - n; +}, "J.api.SymmetryInterface,JU.BS,~S,~N,~B,~A,~S,~A"); +Clazz.defineMethod(c$, "addConstraint", +function(iatom, c){ +if (c == null) { +if (this.atomConstraints != null && this.atomConstraints.length > iatom) { +this.atomConstraints[iatom] = null; +}return null; +}if (this.atomConstraints == null) { +this.atomConstraints = new Array(this.vwr.ms.ac + 10); +}if (this.atomConstraints.length < iatom + 10) { +var a = new Array(this.vwr.ms.ac + 10); +System.arraycopy(this.atomConstraints, 0, a, 0, this.atomConstraints.length); +this.atomConstraints = a; +}return this.atomConstraints[iatom] = c; +}, "~N,J.modelkit.ModelKit.Constraint"); +Clazz.defineMethod(c$, "addInfo", +function(info, key, value){ +if (value != null) info.put(key, value); +}, "java.util.Map,~S,~O"); +Clazz.defineMethod(c$, "addOccupiedAtomsToBitset", +function(bsSelected){ +var bs = new JU.BS(); +for (var iatom = bsSelected.nextSetBit(0); iatom >= 0; iatom = bsSelected.nextSetBit(iatom + 1)) { +var a = this.vwr.ms.at[iatom]; +if (this.vwr.ms.getOccupancyFloat(a.i) == 100) { +bsSelected.set(a.i); +} else { +bs.clearAll(); +this.vwr.ms.getAtomsWithin(0.0001, a, bs, a.mi); +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { +if (this.vwr.ms.getOccupancyFloat(i) == 100) { +bs.clear(i); +bsSelected.clear(i); +}} +bsSelected.or(bs); +}} +}, "JU.BS"); +Clazz.defineMethod(c$, "appRunScript", +function(script){ +this.vwr.runScript(script); +}, "~S"); +Clazz.defineMethod(c$, "assignAtomNoAddedSymmetry", +function(pt, atomIndex, bs, type, newPoint, cmd, site){ +this.assignAtoms(pt, atomIndex, bs, type, newPoint, cmd, false, site, null, null, null, null); +}, "JU.P3,~N,JU.BS,~S,~B,~S,~N"); +Clazz.defineMethod(c$, "assignAtoms", +function(pt, atomIndex, bs, type, newPoint, cmd, isClick, site, sym, points, packing, opsCtr){ +if (sym == null) sym = this.vwr.getOperativeSymmetry(); +var haveAtomByIndex = (atomIndex >= 0); +var isMultipleAtoms = (bs != null && bs.cardinality() > 1); +var nIgnored = 0; +var np = 0; +if (!haveAtomByIndex) atomIndex = (bs == null ? -1 : bs.nextSetBit(0)); +var atom = (atomIndex < 0 ? null : this.vwr.ms.at[atomIndex]); +var bd = (pt != null && atom != null ? pt.distance(atom) : -1); +if (points != null) { +np = nIgnored = points.size(); +sym.toFractional(pt, false); +points.addLast(pt); +if (newPoint && haveAtomByIndex) nIgnored++; +sym.getEquivPointList(points, nIgnored, packing + (newPoint && atomIndex < 0 ? "newpt" : ""), opsCtr); +}var bsEquiv = (atom == null ? null : sym != null ? this.vwr.ms.getSymmetryEquivAtoms(bs, sym, null) : bs == null || bs.cardinality() == 0 ? JU.BSUtil.newAndSetBit(atomIndex) : bs); +var bs0 = (bsEquiv == null ? null : sym == null ? JU.BSUtil.newAndSetBit(atomIndex) : JU.BSUtil.copy(bsEquiv)); +var mi = (atom == null ? this.vwr.am.cmi : atom.mi); +var ac = this.vwr.ms.ac; +var state = this.getMKState(); +var isDelete = type.equals("X"); +try { +if (isDelete) { +if (isClick) { +this.setProperty("rotatebondindex", Integer.$valueOf(-1)); +}this.setConstraint(null, atomIndex, J.modelkit.ModelKit.GET_DELETE); +}if (pt == null && points == null) { +if (atom == null) return; +this.vwr.sm.setStatusStructureModified(atomIndex, mi, 1, cmd, 1, bsEquiv); +for (var i = bsEquiv.nextSetBit(0); i >= 0; i = bsEquiv.nextSetBit(i + 1)) { +this.assignAtom(i, type, this.autoBond, sym == null, isClick); +} +if (!JU.PT.isOneOf(type, ";Mi;Pl;X;")) this.vwr.ms.setAtomNamesAndNumbers(atomIndex, -ac, null, true); +this.vwr.sm.setStatusStructureModified(atomIndex, mi, -1, "OK", 1, bsEquiv); +this.vwr.refresh(3, "assignAtom"); +this.updateElementKey(null); +return; +}this.setMKState(0); +var pts; +if (points == null) { +pts = Clazz.newArray(-1, [pt]); +} else { +pts = new Array(Math.max(0, points.size() - np)); +for (var i = pts.length; --i >= 0; ) { +pts[i] = points.get(np + i); +} +}var vConnections = new JU.Lst(); +var isConnected = false; +if (site == 0) { +if (atom != null) { +if (!isMultipleAtoms) { +vConnections.addLast(atom); +isConnected = true; +} else if (sym != null) { +var p = JU.P3.newP(atom); +sym.toFractional(p, false); +bs.or(bsEquiv); +var list = sym.getEquivPoints(null, p, packing); +for (var j = 0, n = list.size(); j < n; j++) { +for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { +if (this.vwr.ms.at[i].distanceSquared(list.get(j)) < 0.001) { +vConnections.addLast(this.vwr.ms.at[i]); +bs.clear(i); +}} +} +}isConnected = (vConnections.size() == pts.length); +if (isConnected) { +var d = 3.4028235E38; +for (var i = pts.length; --i >= 0; ) { +var d1 = vConnections.get(i).distance(pts[i]); +if (d == 3.4028235E38) d1 = d; + else if (Math.abs(d1 - d) > 0.001) { +isConnected = false; +break; +}} +}if (!isConnected) { +vConnections.clear(); +}this.vwr.sm.setStatusStructureModified(atomIndex, mi, 3, cmd, 1, null); +}if (pt != null || points != null) { +var bsM = this.vwr.getThisModelAtoms(); +for (var i = bsM.nextSetBit(0); i >= 0; i = bsM.nextSetBit(i + 1)) { +var as = this.vwr.ms.at[i].getAtomSite(); +if (as > site) site = as; +} +site++; +}}var pickingMode = this.vwr.acm.getAtomPickingMode(); +var wasHidden = this.menu.hidden; +var isMK = this.vwr.getBoolean(603983903); +if (!isMK && sym == null) { +this.vwr.setBooleanProperty("modelkitmode", true); +this.menu.hidden = true; +this.menu.allowPopup = false; +}var htParams = new java.util.Hashtable(); +if (site > 0) htParams.put("fixedSite", Integer.$valueOf(site)); +htParams.put("element", type); +bs = this.vwr.addHydrogensInline(bs, vConnections, pts, htParams); +if (bd > 0 && !isConnected && vConnections.isEmpty()) { +this.connectAtoms(bd, 1, bs0, bs); +}if (!isMK) { +this.vwr.setBooleanProperty("modelkitmode", false); +this.menu.hidden = wasHidden; +this.menu.allowPopup = true; +this.vwr.acm.setPickingMode(pickingMode); +this.menu.hidePopup(); +}var atomIndexNew = bs.nextSetBit(0); +if (points == null) { +this.assignAtom(atomIndexNew, type, false, atomIndex >= 0 && sym == null, true); +if (atomIndex >= 0) { +var doAutobond = (sym == null && !"H".equals(type)); +this.assignAtom(atomIndex, ".", false, doAutobond, isClick); +}this.vwr.ms.setAtomNamesAndNumbers(atomIndexNew, -ac, null, true); +this.vwr.sm.setStatusStructureModified(atomIndexNew, mi, -3, "OK", 1, bs); +return; +}if (atomIndexNew >= 0) { +for (var i = atomIndexNew; i >= 0; i = bs.nextSetBit(i + 1)) { +this.assignAtom(i, type, false, false, true); +this.vwr.ms.setSite(this.vwr.ms.at[i], -1, false); +this.vwr.ms.setSite(this.vwr.ms.at[i], site, true); +} +this.vwr.ms.updateBasisFromSite(mi); +}var firstAtom = this.vwr.ms.am[mi].firstAtomIndex; +this.vwr.ms.setAtomNamesAndNumbers(firstAtom, -ac, null, true); +this.vwr.sm.setStatusStructureModified(-1, mi, -3, "OK", 1, bs); +this.updateModelElementKey(mi, true); +} catch (ex) { +if (Clazz.exceptionOf(ex, Exception)){ +ex.printStackTrace(); +} else { +throw ex; +} +} finally { +this.setMKState(state); +} +}, "JU.P3,~N,JU.BS,~S,~B,~S,~B,~N,J.api.SymmetryInterface,JU.Lst,~S,~A"); +Clazz.defineMethod(c$, "assignAtom", +function(atomIndex, type, autoBond, addHsAndBond, isClick){ +if (isClick) { +if (this.vwr.isModelkitPickingRotateBond()) { +this.bondAtomIndex1 = atomIndex; +return -1; +}if (this.clickProcessAtom(atomIndex) || !this.clickToSetElement && this.vwr.ms.getAtom(atomIndex).getElementNumber() != 1) return -1; +}var atom = this.vwr.ms.at[atomIndex]; +if (atom == null) return -1; +this.vwr.ms.clearDB(atomIndex); +if (type == null) type = "C"; +var bs = new JU.BS(); +var wasH = (atom.getElementNumber() == 1); +var atomicNumber = ("PPlMiX".indexOf(type) > 0 ? -1 : type.equals("Xx") ? 0 : JU.PT.isUpperCase(type.charAt(0)) ? JU.Elements.elementNumberFromSymbol(type, true) : -1); +var isDelete = false; +if (atomicNumber >= 0) { +var doTaint = (atomicNumber > 1 || !addHsAndBond); +this.vwr.ms.setElement(atom, atomicNumber, doTaint); +this.vwr.shm.setShapeSizeBs(0, 0, this.vwr.rd, JU.BSUtil.newAndSetBit(atomIndex)); +this.vwr.ms.setAtomName(atomIndex, type + atom.getAtomNumber(), doTaint); +if (this.vwr.getBoolean(603983903)) this.vwr.ms.am[atom.mi].isModelKit = true; +if (!this.vwr.ms.am[atom.mi].isModelKit || atomicNumber > 1) this.vwr.ms.taintAtom(atomIndex, 0); +} else if (type.toLowerCase().equals("pl")) { +atom.setFormalCharge(atom.getFormalCharge() + 1); +} else if (type.toLowerCase().equals("mi")) { +atom.setFormalCharge(atom.getFormalCharge() - 1); +} else if (type.equals("X")) { +isDelete = true; +} else if (!type.equals(".") || !this.addHydrogens) { +return -1; +}if (!addHsAndBond && !isDelete) return atomicNumber; +if (!wasH) this.vwr.ms.removeUnnecessaryBonds(atom, isDelete); +var dx = 0; +if (atom.getCovalentBondCount() == 1) { +if (atomicNumber == 1) { +dx = 1.0; +} else { +dx = 1.5; +}}if (dx != 0) { +var v = JU.V3.newVsub(atom, this.vwr.ms.at[atom.getBondedAtomIndex(0)]); +var d = v.length(); +v.normalize(); +v.scale(dx - d); +this.vwr.ms.setAtomCoordRelative(atomIndex, v.x, v.y, v.z); +}var bsA = JU.BSUtil.newAndSetBit(atomIndex); +if (isDelete) { +this.vwr.deleteAtoms(bsA, false); +}if (atomicNumber != 1 && autoBond) { +this.vwr.ms.validateBspf(false); +bs = this.vwr.ms.getAtomsWithinRadius(1.0, bsA, false, null, null); +bs.andNot(bsA); +if (bs.nextSetBit(0) >= 0) this.vwr.deleteAtoms(bs, false); +bs = this.vwr.getModelUndeletedAtomsBitSet(atom.mi); +bs.andNot(this.vwr.ms.getAtomBitsMDa(1612709900, null, new JU.BS())); +this.vwr.ms.makeConnections2(0.1, 1.8, 1, 1073741904, bsA, bs, null, false, false, 0, null); +}if (this.addHydrogens) this.vwr.addHydrogens(bsA, 1); +return atomicNumber; +}, "~N,~S,~B,~B,~B"); +Clazz.defineMethod(c$, "assignBond", +function(bondIndex, bondOrder, bsAtoms){ +var bond = this.vwr.ms.bo[bondIndex]; +this.vwr.ms.clearDB(bond.atom1.i); +if (bondOrder < 0) return false; +try { +var a1H = (bond.atom1.getElementNumber() == 1); +var isH = (a1H || bond.atom2.getElementNumber() == 1); +if (isH && bondOrder > 1) { +this.vwr.deleteAtoms(JU.BSUtil.newAndSetBit(a1H ? bond.atom1.i : bond.atom2.i), false); +return true; +}if (bondOrder == 0) { +this.vwr.deleteBonds(JU.BSUtil.newAndSetBit(bond.index)); +} else { +bond.setOrder(bondOrder | 131072); +if (!isH) { +this.vwr.ms.removeUnnecessaryBonds(bond.atom1, false); +this.vwr.ms.removeUnnecessaryBonds(bond.atom2, false); +}}} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +JU.Logger.error("Exception in seBondOrder: " + e.toString()); +} else { +throw e; +} +} +if (bondOrder != 0 && this.addHydrogens) this.vwr.addHydrogens(bsAtoms, 1); +return true; +}, "~N,~N,JU.BS"); +Clazz.defineMethod(c$, "assignBondAndType", +function(bondIndex, bondOrder, type, cmd){ +var modelIndex = -1; +var state = this.getMKState(); +try { +this.setMKState(0); +var a1 = this.vwr.ms.bo[bondIndex].atom1; +modelIndex = a1.mi; +var ac = this.vwr.ms.ac; +var bsAtoms = JU.BSUtil.newAndSetBit(a1.i); +bsAtoms.set(this.vwr.ms.bo[bondIndex].atom2.i); +this.vwr.sm.setStatusStructureModified(bondIndex, modelIndex, 6, cmd, 1, bsAtoms); +this.assignBond(bondIndex, bondOrder, bsAtoms); +this.vwr.ms.setAtomNamesAndNumbers(a1.i, -ac, null, true); +this.vwr.refresh(3, "setBondOrder"); +this.vwr.sm.setStatusStructureModified(bondIndex, modelIndex, -6, "" + type, 1, bsAtoms); +} catch (ex) { +if (Clazz.exceptionOf(ex, Exception)){ +JU.Logger.error("assignBond failed"); +this.vwr.sm.setStatusStructureModified(bondIndex, modelIndex, -6, "ERROR " + ex, 1, null); +} else { +throw ex; +} +} finally { +this.setMKState(state); +} +}, "~N,~N,~S,~S"); +Clazz.defineMethod(c$, "assignMoveAtom", +function(iatom, pt, bsFixed, bsModelAtoms, bsMoved){ +if (Float.isNaN(pt.x) || iatom < 0) return 0; +var bs = JU.BSUtil.newAndSetBit(iatom); +if (bsModelAtoms == null) bsModelAtoms = this.vwr.getThisModelAtoms(); +bs.and(bsModelAtoms); +if (bs.isEmpty()) return 0; +var state = this.getMKState(); +this.setMKState(0); +var n = 0; +try { +var sym = this.getSym(iatom); +var bseq = new JU.BS(); +this.vwr.ms.getSymmetryEquivAtomsForAtom(iatom, null, bsModelAtoms, bseq); +if (this.setConstraint(sym, bseq.nextSetBit(0), J.modelkit.ModelKit.GET_CREATE).type == 6) { +return 0; +}if (bsFixed != null && !bsFixed.isEmpty()) bseq.andNot(bsFixed); +n = bseq.cardinality(); +if (n == 0) { +return 0; +}var a = this.vwr.ms.at[iatom]; +var v0 = sym.getInvariantSymops(a, null); +var v1 = sym.getInvariantSymops(pt, v0); +if ((v1 == null) != (v0 == null) || !java.util.Arrays.equals(v0, v1)) return 0; +var points = new Array(n); +var ia0 = bseq.nextSetBit(0); +if (!this.fillPointsForMove(sym, bseq, ia0, a, pt, points)) { +return 0; +}bsMoved.or(bseq); +var mi = this.vwr.ms.at[ia0].mi; +this.vwr.sm.setStatusStructureModified(ia0, mi, 3, "dragatom", n, bseq); +for (var k = 0, ia = bseq.nextSetBit(0); ia >= 0; ia = bseq.nextSetBit(ia + 1)) { +var p = points[k++]; +this.vwr.ms.setAtomCoord(ia, p.x, p.y, p.z); +} +this.vwr.sm.setStatusStructureModified(ia0, mi, -3, "dragatom", n, bseq); +return n; +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +System.err.println("Modelkit err" + e); +return 0; +} else { +throw e; +} +} finally { +this.setMKState(state); +if (n > 0) { +this.updateDrawAtomSymmetry("atomsMoved", bsMoved); +}} +}, "~N,JU.P3,JU.BS,JU.BS,JU.BS"); +Clazz.defineMethod(c$, "assignMoveAtoms", +function(sym, bsSelected, bsFixed, bsModelAtoms, iatom, p, pts, allowProjection, isMolecule){ +if (sym == null) sym = this.getSym(iatom); +var npts = bsSelected.cardinality(); +if (npts == 0) return 0; +var n = 0; +var i0 = bsSelected.nextSetBit(0); +if (bsFixed == null) bsFixed = this.vwr.getMotionFixedAtoms(sym, null); +if (bsModelAtoms == null) bsModelAtoms = this.vwr.getModelUndeletedAtomsBitSet(this.vwr.ms.at[i0].mi); +if (pts != null) { +if (npts != pts.length) return 0; +var bs = new JU.BS(); +for (var ip = 0, i = bsSelected.nextSetBit(0); i >= 0; i = bsSelected.nextSetBit(i + 1)) { +bs.clearAll(); +bs.set(i); +n += this.assignMoveAtoms(sym, bs, bsFixed, bsModelAtoms, i, pts[ip++], null, true, isMolecule); +} +return n; +}var nAtoms = bsSelected.cardinality(); +if (bsSelected.intersects(bsFixed)) { +p.x = NaN; +return 0; +}this.addOccupiedAtomsToBitset(bsSelected); +nAtoms = bsSelected.cardinality(); +if (nAtoms == 1 && !isMolecule) { +var bsMoved = this.moveConstrained(iatom, bsFixed, bsModelAtoms, p, true, allowProjection, null); +return (bsMoved == null ? 0 : bsMoved.cardinality()); +}var p1 = JU.P3.newP(p); +p.x = NaN; +if (this.moveConstrained(iatom, bsFixed, bsModelAtoms, p1, false, true, null) == null) { +return 0; +}var vrel = JU.V3.newV(p1); +vrel.sub(this.vwr.ms.at[iatom]); +var apos0 = this.vwr.ms.saveAtomPositions(); +var bsAll = JU.BSUtil.copy(bsSelected); +if (isMolecule) { +var bsTest = JU.BSUtil.copy(bsModelAtoms); +bsTest.andNot(bsSelected); +var bsSites = new JU.BS(); +for (var i = bsSelected.nextSetBit(0); i >= 0; i = bsSelected.nextSetBit(i + 1)) { +bsSites.set(this.vwr.ms.at[i].getAtomSite()); +} +for (var i = bsTest.nextSetBit(0); i >= 0; i = bsTest.nextSetBit(i + 1)) { +if (bsSites.get(this.vwr.ms.at[i].getAtomSite())) { +var bs = this.vwr.ms.getMoleculeBitSetForAtom(i); +n = bs.cardinality(); +if (n > nAtoms) { +nAtoms = n; +bsTest.andNot(bs); +bsAll = bs; +}}} +if (!bsAll.equals(bsSelected)) this.vwr.select(bsAll, false, 0, true); +}var apos = new Array(bsAll.cardinality()); +var maxSite = 0; +for (var i = bsAll.nextSetBit(0); i >= 0; i = bsAll.nextSetBit(i + 1)) { +var s = this.vwr.ms.at[i].getAtomSite(); +if (s > maxSite) maxSite = s; +} +var sites = Clazz.newIntArray (maxSite, 0); +pts = new Array(maxSite); +var bsMoved = new JU.BS(); +for (var ip = 0, i = bsAll.nextSetBit(0); i >= 0; i = bsAll.nextSetBit(i + 1), ip++) { +p1.setT(this.vwr.ms.at[i]); +p1.add(vrel); +apos[ip] = JU.P3.newP(p1); +var s = this.vwr.ms.at[i].getAtomSite() - 1; +if (sites[s] == 0) { +if (this.moveConstrained(i, bsFixed, bsModelAtoms, p1, false, true, bsMoved) == null) { +return 0; +}p1.sub(this.vwr.ms.at[i]); +p1.sub(vrel); +pts[s] = JU.P3.newP(p1); +sites[s] = i + 1; +}} +bsMoved.clearAll(); +for (var i = sites.length; --i >= 0; ) { +var ia = sites[i] - 1; +if (ia >= 0) { +p1.setT(this.vwr.ms.at[ia]); +p1.add(vrel); +if (this.moveConstrained(ia, bsFixed, bsModelAtoms, p1, true, true, bsMoved) == null) { +bsMoved = null; +break; +}}} +n = (bsMoved == null ? 0 : bsMoved.cardinality()); +if (n == 0) { +this.vwr.ms.restoreAtomPositions(apos0); +return 0; +}return (this.checkAtomPositions(apos0, apos, bsAll) ? n : 0); +}, "J.api.SymmetryInterface,JU.BS,JU.BS,JU.BS,~N,JU.P3,~A,~B,~B"); +Clazz.defineMethod(c$, "assignSpaceGroup", +function(sym00, ita00, bs, paramsOrUC, tokens, index, trm, prevNode, sb){ +if (index >= tokens.length) return "invalid CLEG expression!"; +var haveUCParams = (paramsOrUC != null); +if (tokens.length > 1 && haveUCParams) { +return "invalid syntax - can't mix transformations and UNITCELL option!"; +}var token = tokens[index].trim(); +var isSubgroupCalc = token.length == 0 || token.equals("sub") || token.equals("super"); +var calcNext = (isSubgroupCalc ? token : null); +if (isSubgroupCalc) { +token = tokens[++index].trim(); +}var isFinal = (index == tokens.length - 1); +var pt = token.lastIndexOf(":"); +var haveUnitCell = (sym00 != null); +var isUnknown = false; +var haveTransform = (token.length == 0 || token.indexOf(',') > 0 || "!r!h".indexOf(token) >= 0); +var haveJmolSetting = (!haveTransform && pt > 0 && pt < token.length - 1); +var isTransformOnly = (haveTransform && pt < 0); +var transform = (haveTransform ? token.substring(pt + 1) : null); +var trTemp = new JU.M4(); +var restarted = false; +var sym = this.vwr.getSymTemp(); +if (prevNode == null) { +if (!J.modelkit.ModelKit.ClegNode.checkSyntax(tokens, sym)) return "invalid CLEG expression!"; +if (!haveUnitCell && !haveUCParams && (haveTransform || (pt = token.indexOf('.')) > 0)) { +var ita = token.substring(0, pt); +var err = this.assignSpaceGroup(null, null, null, null, Clazz.newArray(-1, [ita]), 0, null, null, sb); +if (err.endsWith("!")) return err; +sym00 = this.vwr.getOperativeSymmetry(); +if (sym00 == null) return "modelkit spacegroup initialization error!"; +haveUnitCell = true; +restarted = true; +}var ita0 = (haveUnitCell ? sym00.getIntTableNumber() : null); +var trm0 = null; +if (haveUnitCell) { +if (ita0 == null || ita0.equals("0")) ita0 = sym00.getClegId(); + else trm0 = sym00.getSpaceGroupInfoObj("itaTransform", null, false, false); +}trm = new JU.M4(); +trm.setIdentity(); +prevNode = new J.modelkit.ModelKit.ClegNode(-1, ita0, trm0); +if (!prevNode.update(this.vwr, null, trm, trTemp, sym)) return prevNode.errString; +}if (isSubgroupCalc) { +prevNode.calcNext = calcNext; +}if (transform != null) { +switch (transform) { +case "r": +case "!h": +transform = "2/3a+1/3b+1/3c,-1/3a+1/3b+1/3c,-1/3a-2/3b+1/3c"; +break; +case "h": +case "!r": +transform = "!2/3a+1/3b+1/3c,-1/3a+1/3b+1/3c,-1/3a-2/3b+1/3c"; +break; +default: +if (haveJmolSetting) { +pt = 0; +haveTransform = false; +transform = null; +}} +if (pt > 0) token = token.substring(0, pt); +}if (isTransformOnly) { +if (isFinal) { +isUnknown = true; +return "CLEG pathway is incomplete!"; +}if (transform == null || transform.length == 0) transform = "a,b,c"; +sym.convertTransform(transform, trTemp); +if (trm == null) trm = trTemp; + else trm.mul(trTemp); +if (token.length != 0) { +prevNode.addTransform(trTemp); +System.out.println("ModelKit.assignSpaceGroup index=" + index + " trm=" + trm); +}return this.assignSpaceGroup(sym00, ita00, bs, null, tokens, ++index, trm, prevNode, sb); +}var node = new J.modelkit.ModelKit.ClegNode(index, token, transform); +if (!node.update(this.vwr, prevNode, trm, trTemp, sym)) return node.errString; +node.updateTokens(tokens, index); +if (!isFinal) return this.assignSpaceGroup(sym00, ita00, bs, null, tokens, ++index, trm, node, sb); +var params = null; +var oabc = null; +var origin = null; +params = (!haveUCParams || !JU.AU.isAD(paramsOrUC) ? null : paramsOrUC); +if (!haveUnitCell) { +sym.setUnitCellFromParams(params == null ? Clazz.newFloatArray(-1, [10, 10, 10, 90, 90, 90]) : params, false, NaN); +paramsOrUC = null; +haveUCParams = false; +}if (haveUCParams) { +if (JU.AU.isAD(paramsOrUC)) { +params = paramsOrUC; +} else { +oabc = paramsOrUC; +origin = oabc[0]; +}} else if (haveUnitCell) { +sym = sym00; +if (trm == null) { +trm = new JU.M4(); +trm.setIdentity(); +}oabc = sym.getV0abc( Clazz.newArray(-1, [trm]), null); +origin = oabc[0]; +}if (oabc != null) { +params = sym.getUnitCell(oabc, false, "assign").getUnitCellParams(); +if (origin == null) origin = oabc[0]; +}var isP1 = (token.equalsIgnoreCase("P1") || token.equals("ITA/1.1")); +this.clearAtomConstraints(); +try { +if (bs != null && bs.isEmpty()) return "no atoms specified!"; +var bsAtoms = this.vwr.getThisModelAtoms(); +var bsCell = (isP1 ? bsAtoms : JS.SV.getBitSet(this.vwr.evaluateExpressionAsVariable("{within(unitcell)}"), true)); +if (bs == null) { +bs = bsAtoms; +}if (bs != null) { +bsAtoms.and(bs); +if (!isP1) bsAtoms.and(bsCell); +}var noAtoms = bsAtoms.isEmpty(); +var mi = (noAtoms && this.vwr.am.cmi < 0 ? 0 : noAtoms ? this.vwr.am.cmi : this.vwr.ms.at[bsAtoms.nextSetBit(0)].getModelIndex()); +this.vwr.ms.getModelAuxiliaryInfo(mi).remove("spaceGroupInfo"); +if (haveUnitCell) { +sym.replaceTransformMatrix(trm); +}if (params == null) params = sym.getUnitCellMultiplied().getUnitCellParams(); +var sgInfo = (noAtoms && isUnknown ? null : this.vwr.findSpaceGroup(sym, isUnknown ? bsAtoms : null, isUnknown ? null : node.name, params, origin, oabc, 2 | (haveUnitCell ? 0 : 4))); +if (sgInfo == null) { +return "Space group " + node.name + " is unknown or not compatible!"; +}if (oabc == null || !haveUnitCell) oabc = sgInfo.get("unitcell"); +token = sgInfo.get("name"); +var jmolId = sgInfo.get("jmolId"); +var basis = sgInfo.get("basis"); +var sg = sgInfo.remove("sg"); +sym.getUnitCell(oabc, false, null); +sym.setSpaceGroupTo(sg == null ? jmolId : sg); +sym.setSpaceGroupName(token); +if (basis == null) { +basis = sym.removeDuplicates(this.vwr.ms, bsAtoms, true); +}this.vwr.ms.setSpaceGroup(mi, sym, basis); +if (!haveUnitCell || restarted) { +this.appRunScript("unitcell on; center unitcell;axes unitcell; axes 0.1; axes on;set perspectivedepth false;moveto 0 axis c1;draw delete;show spacegroup"); +}transform = sym.staticGetTransformABC(trm, false); +var msg = transform + "\n" + JU.PT.join(tokens, '>', 0) + (basis.isEmpty() ? "" : "\n basis=" + basis); +System.out.println("ModelKit trm=" + msg); +sb.append(msg).append("\n"); +return transform; +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +if (!JV.Viewer.isJS) e.printStackTrace(); +return e.getMessage() + "!"; +} else { +throw e; +} +} +}, "J.api.SymmetryInterface,~S,JU.BS,~O,~A,~N,JU.M4,J.modelkit.ModelKit.ClegNode,JU.SB"); +c$.addSGTransform = Clazz.defineMethod(c$, "addSGTransform", +function(sym, tr, trm0, temp){ +if (trm0 == null) { +trm0 = new JU.M4(); +trm0.setIdentity(); +}if (tr != null) { +sym.convertTransform(tr, temp); +trm0.mul(temp); +}return trm0; +}, "J.api.SymmetryInterface,~S,JU.M4,JU.M4"); +Clazz.defineMethod(c$, "checkAtomPositions", +function(apos0, apos, bs){ +var ok = true; +for (var ip = 0, i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1), ip++) { +if (this.vwr.ms.at[i].distanceSquared(apos[ip]) > 0.00000001) { +ok = false; +break; +}} +if (ok) return true; +this.vwr.ms.restoreAtomPositions(apos0); +return false; +}, "~A,~A,JU.BS"); +Clazz.defineMethod(c$, "clearElementKey", +function(modelIndex){ +if (!this.haveElementKeys) return; +var key = J.modelkit.ModelKit.getElementKey(modelIndex) + "*"; +var val = Clazz.newArray(-1, [ Clazz.newArray(-1, ["thisID", key]), Clazz.newArray(-1, ["delete", null])]); +this.vwr.shm.setShapeProperties(22, val); +this.vwr.shm.setShapeProperties(31, val); +switch (modelIndex) { +case -2: +break; +case -1: +this.bsElementKeyModels.clearAll(); +break; +default: +this.bsElementKeyModels.clear(modelIndex); +break; +} +this.haveElementKeys = !this.bsElementKeyModels.isEmpty(); +}, "~N"); +Clazz.defineMethod(c$, "clickProcessAtom", +function(atomIndex){ +switch (this.getMKState()) { +case 0: +return this.vwr.isModelkitPickingRotateBond(); +case 1: +this.centerAtomIndex = atomIndex; +if (this.getSymViewState() == 0) this.setSymViewState(8); +this.showXtalSymmetry(); +return true; +case 2: +if (atomIndex == this.centerAtomIndex) return true; +J.modelkit.ModelKit.notImplemented("edit click"); +return false; +} +J.modelkit.ModelKit.notImplemented("atom click unknown XTAL state"); +return false; +}, "~N"); +Clazz.defineMethod(c$, "clickProcessMode", +function(action){ +this.processMKPropertyItem(action, false); +}, "~S"); +Clazz.defineMethod(c$, "clickProcessSel", +function(action){ +if (action === "mksel_atom") { +this.centerPoint = null; +this.centerAtomIndex = -1; +this.secondAtomIndex = -1; +} else if (action === "mksel_position") { +var pos = this.promptUser("Enter three fractional coordinates", this.lastCenter); +if (pos == null) return; +this.lastCenter = pos; +var p = J.modelkit.ModelKit.pointFromTriad(pos); +if (p == null) { +this.clickProcessSel(action); +return; +}this.centerAtomIndex = -2147483647; +this.centerPoint = p; +this.showXtalSymmetry(); +}}, "~S"); +Clazz.defineMethod(c$, "clickProcessSelOp", +function(action){ +this.secondAtomIndex = -1; +if (action === "mkselop_addoffset") { +var pos = this.promptUser("Enter i j k for an offset for viewing the operator - leave blank to clear", this.lastOffset); +if (pos == null) return null; +this.lastOffset = pos; +if (pos.length == 0 || pos === "none") { +this.setProperty("offset", "none"); +return null; +}var p = J.modelkit.ModelKit.pointFromTriad(pos); +if (p == null) { +return action; +}this.setProperty("offset", p); +} else if (action === "mkselop_atom2") { +J.modelkit.ModelKit.notImplemented(action); +}return null; +}, "~S"); +Clazz.defineMethod(c$, "clickProcessSym", +function(action){ +if (action === "mksymmetry_none") { +this.setSymEdit(0); +} else { +this.processMKPropertyItem(action, false); +}}, "~S"); +Clazz.defineMethod(c$, "clickProcessUC", +function(action){ +this.processMKPropertyItem(action, false); +this.showXtalSymmetry(); +}, "~S"); +Clazz.defineMethod(c$, "connectAtoms", +function(bd, bondOrder, bs1, bs2){ +this.vwr.makeConnections((bd - 0.01), (bd + 0.01), bondOrder, 1073742026, bs1, bs2, new JU.BS(), false, false, 0); +}, "~N,~N,JU.BS,JU.BS"); +Clazz.defineMethod(c$, "fillPointsForMove", +function(sg, bseq, i0, a, pt, points){ +var d = a.distance(pt); +var fa = JU.P3.newP(a); +var fb = JU.P3.newP(pt); +sg.toFractional(fa, false); +sg.toFractional(fb, false); +for (var k = 0, i = i0; i >= 0; i = bseq.nextSetBit(i + 1)) { +var p = JU.P3.newP(this.vwr.ms.at[i]); +var p0 = JU.P3.newP(p); +sg.toFractional(p, false); +var m = sg.getTransform(fa, p, false); +if (m == null) { +return false; +}var p2 = JU.P3.newP(fb); +m.rotTrans(p2); +sg.toCartesian(p2, false); +if (Math.abs(d - p0.distance(p2)) > 0.001) return false; +points[k++] = p2; +} +fa.setT(points[0]); +sg.toFractional(fa, false); +for (var k = points.length; --k >= 0; ) { +fb.setT(points[k]); +sg.toFractional(fb, false); +var m = sg.getTransform(fa, fb, false); +if (m == null) { +return false; +}for (var i = points.length; --i > k; ) { +if (points[i].distance(points[k]) < 0.1) return false; +} +} +return true; +}, "J.api.SymmetryInterface,JU.BS,~N,JU.P3,JU.P3,~A"); +Clazz.defineMethod(c$, "getBondLabel", +function(atoms){ +return atoms[Math.min(this.bondAtomIndex1, this.bondAtomIndex2)].getAtomName() + "-" + atoms[Math.max(this.bondAtomIndex1, this.bondAtomIndex2)].getAtomName(); +}, "~A"); +Clazz.defineMethod(c$, "getBondOrder", +function(type, bond){ +if (type == '-') type = this.pickBondAssignType; +var bondOrder = type.charCodeAt(0) - 48; +switch ((type).charCodeAt(0)) { +case 48: +case 49: +case 50: +case 51: +case 52: +case 53: +break; +case 112: +case 109: +bondOrder = (JU.Edge.getBondOrderNumberFromOrder(bond.getCovalentOrder()).charAt(0)).charCodeAt(0) - 48 + (type == 'p' ? 1 : -1); +if (bondOrder > 3) bondOrder = 1; + else if (bondOrder < 0) bondOrder = 3; +break; +default: +return -1; +} +return bondOrder; +}, "~S,JM.Bond"); +Clazz.defineMethod(c$, "getHoverLabel", +function(atomIndex){ +var state = this.getMKState(); +var msg = null; +switch (state) { +case 1: +if (this.symop == null) this.symop = Integer.$valueOf(1); +msg = "view symop " + this.symop + " for " + this.vwr.getAtomInfo(atomIndex); +break; +case 2: +msg = "start editing for " + this.vwr.getAtomInfo(atomIndex); +break; +case 0: +var atoms = this.vwr.ms.at; +if (this.isRotateBond) { +this.setBranchAtom(atomIndex, false); +msg = (this.branchAtomIndex >= 0 ? "rotate branch " + atoms[atomIndex].getAtomName() : "rotate bond for " + this.getBondLabel(atoms)); +}if (this.bondIndex < 0) { +if (this.atomHoverLabel.length <= 2) { +msg = this.atomHoverLabel = "Click to change to " + this.atomHoverLabel + " or drag to add " + this.atomHoverLabel; +} else { +msg = atoms[atomIndex].getAtomName() + ": " + this.atomHoverLabel; +this.vwr.highlight(JU.BSUtil.newAndSetBit(atomIndex)); +}} else { +if (msg == null) { +switch (this.isRotateBond ? this.bsHighlight.cardinality() : atomIndex >= 0 ? 1 : -1) { +case 0: +this.vwr.highlight(JU.BSUtil.newAndSetBit(atomIndex)); +case 1: +case 2: +var a = this.vwr.ms.at[atomIndex]; +if (!this.isRotateBond) { +this.menu.setActiveMenu("atomMenu"); +if (this.vwr.acm.getAtomPickingMode() == 1) return null; +}if (this.atomHoverLabel.indexOf("charge") >= 0) { +var ch = a.getFormalCharge(); +ch += (this.atomHoverLabel.indexOf("increase") >= 0 ? 1 : -1); +msg = this.atomHoverLabel + " to " + (ch > 0 ? "+" : "") + ch; +} else { +msg = this.atomHoverLabel; +}msg = atoms[atomIndex].getAtomName() + ": " + msg; +break; +case -1: +msg = (this.bondHoverLabel.length == 0 ? "" : this.bondHoverLabel + " for ") + this.getBondLabel(atoms); +break; +} +}}break; +} +return msg; +}, "~N"); +Clazz.defineMethod(c$, "getinfo", +function(){ +var info = new java.util.Hashtable(); +this.addInfo(info, "addHydrogens", Boolean.$valueOf(this.addHydrogens)); +this.addInfo(info, "autobond", Boolean.$valueOf(this.autoBond)); +this.addInfo(info, "clickToSetElement", Boolean.$valueOf(this.clickToSetElement)); +this.addInfo(info, "hidden", Boolean.$valueOf(this.menu.hidden)); +this.addInfo(info, "showSymopInfo", Boolean.$valueOf(this.showSymopInfo)); +this.addInfo(info, "centerPoint", this.centerPoint); +this.addInfo(info, "centerAtomIndex", Integer.$valueOf(this.centerAtomIndex)); +this.addInfo(info, "secondAtomIndex", Integer.$valueOf(this.secondAtomIndex)); +this.addInfo(info, "symop", this.symop); +this.addInfo(info, "offset", this.viewOffset); +this.addInfo(info, "drawData", this.drawData); +this.addInfo(info, "drawScript", this.drawScript); +this.addInfo(info, "isMolecular", Boolean.$valueOf(this.getMKState() == 0)); +return info; +}); +c$.getNearestBondedAtom = Clazz.defineMethod(c$, "getNearestBondedAtom", +function(a1, butNotThis){ +var b = a1.bonds; +var a2; +var ret = null; +var zmin = 2147483647; +for (var i = a1.getBondCount(); --i >= 0; ) { +if (b[i] != null && b[i].isCovalent() && (a2 = b[i].getOtherAtom(a1)) !== butNotThis && a2.sZ < zmin) { +zmin = a2.sZ; +ret = a2; +}} +return ret; +}, "JM.Atom,JM.Atom"); +Clazz.defineMethod(c$, "handleAtomDragging", +function(countPlusIndices){ +switch (this.getMKState()) { +case 0: +return false; +case 2: +if (countPlusIndices[0] > 2) return true; +J.modelkit.ModelKit.notImplemented("drag atom for XTAL edit"); +break; +case 1: +if (this.getSymViewState() == 0) this.setSymViewState(8); +switch (countPlusIndices[0]) { +case 1: +this.centerAtomIndex = countPlusIndices[1]; +this.secondAtomIndex = -1; +break; +case 2: +this.centerAtomIndex = countPlusIndices[1]; +this.secondAtomIndex = countPlusIndices[2]; +break; +} +this.showXtalSymmetry(); +return true; +} +return true; +}, "~A"); +Clazz.defineMethod(c$, "handleAtomOrBondPicked", +function(x, y, mp, dragAtomIndex, atomType, inRange){ +var isCharge = this.$isPickAtomAssignCharge; +if (mp != null && mp.count == 2) { +this.vwr.undoMoveActionClear(-1, 4146, true); +var a = mp.getAtom(1); +var b = mp.getAtom(2); +var bond = a.getBond(b); +if (bond == null) { +this.cmdAssignConnect(a.i, b.i, '1', "click"); +} else { +this.cmdAssignBond(bond.index, 'p', "click"); +}} else { +if (atomType.equals("Xx")) { +atomType = this.lastElementType; +}if (inRange) { +this.vwr.undoMoveActionClear(dragAtomIndex, 4, true); +} else { +this.vwr.undoMoveActionClear(-1, 4146, true); +}var a = this.vwr.ms.at[dragAtomIndex]; +var wasH = (a != null && a.getElementNumber() == 1); +this.clickAssignAtom(dragAtomIndex, atomType, null); +if (isCharge) { +this.appRunScript("{atomindex=" + dragAtomIndex + "}.label='%C'"); +} else { +this.vwr.undoMoveActionClear(-1, 4146, true); +if (a == null || inRange) return false; +if (wasH) { +this.clickAssignAtom(dragAtomIndex, "X", null); +} else { +var ptNew = JU.P3.new3(x, y, a.sZ); +this.vwr.tm.unTransformPoint(ptNew, ptNew); +this.clickAssignAtom(dragAtomIndex, atomType, ptNew); +}}}return true; +}, "~N,~N,JM.MeasurementPending,~N,~S,~B"); +Clazz.defineMethod(c$, "minimizeXtal", +function(eval, bsBasis, steps, crit, rangeFixed, flags){ +this.minBasisModel = this.vwr.am.cmi; +this.minSelectionSaved = this.vwr.bsA(); +this.vwr.am.setFrame(this.minBasisModel); +this.minBasis = bsBasis; +this.minBasisFixed = this.vwr.getMotionFixedAtoms(null, null); +this.minBasisModelAtoms = this.vwr.getModelUndeletedAtomsBitSet(this.minBasisModel); +var cif = this.vwr.getModelExtract(bsBasis, false, false, "cif"); +var tempModelIndex = this.vwr.ms.mc; +var htParams = new java.util.Hashtable(); +htParams.put("eval", eval); +htParams.put("lattice", JU.P3.new3(444, 666, 1)); +htParams.put("fileData", cif); +htParams.put("loadScript", new JU.SB()); +if (this.vwr.loadModelFromFile(null, " ", null, null, true, htParams, null, null, 0, " ") != null) return; +var bsBasis2 = JU.BSUtil.copy(this.vwr.ms.am[tempModelIndex].bsAsymmetricUnit); +this.minTempModelAtoms = this.vwr.getModelUndeletedAtomsBitSet(tempModelIndex); +this.vwr.am.setFrame(tempModelIndex); +this.minTempFixed = JU.BSUtil.copy(this.minTempModelAtoms); +this.minTempFixed.andNot(bsBasis2); +this.vwr.getMotionFixedAtoms(null, this.minTempFixed); +this.vwr.minimize(eval, steps, crit, JU.BSUtil.copy(bsBasis2), this.minTempFixed, this.minTempModelAtoms, rangeFixed, flags & -257); +}, "J.api.JmolScriptEvaluator,JU.BS,~N,~N,~N,~N"); +Clazz.defineMethod(c$, "minimizeXtalEnd", +function(bsBasis2, isEnd){ +if (this.minBasis == null) return; +if (bsBasis2 != null) { +var pts = new Array(bsBasis2.cardinality()); +for (var p = 0, j = this.minBasis.nextSetBit(0), i = bsBasis2.nextSetBit(0); i >= 0; i = bsBasis2.nextSetBit(i + 1), j = this.minBasis.nextSetBit(j + 1)) { +pts[p++] = JU.P3.newP(this.vwr.ms.at[i].getXYZ()); +} +var bs = JU.BSUtil.copy(this.minBasis); +bs.andNot(this.minBasisFixed); +this.assignMoveAtoms(null, bs, this.minBasisFixed, this.minBasisModelAtoms, this.minBasis.nextSetBit(0), null, pts, true, false); +}if (isEnd) { +this.minSelectionSaved = null; +this.minBasis = null; +this.minBasisFixed = null; +this.minTempFixed = null; +this.minTempModelAtoms = null; +this.minBasisModelAtoms = null; +this.minBasisAtoms = null; +this.modelSyms = null; +this.vwr.deleteModels(this.vwr.ms.mc - 1, null); +this.vwr.setSelectionSet(this.minSelectionSaved); +this.vwr.setCurrentModelIndex(this.minBasisModel); +}}, "JU.BS,~B"); +Clazz.defineMethod(c$, "moveConstrained", +function(iatom, bsFixed, bsModelAtoms, ptNew, doAssign, allowProjection, bsMoved){ +var sym = this.getSym(iatom); +if (sym == null) { +return null; +}if (bsMoved == null) bsMoved = JU.BSUtil.newAndSetBit(iatom); +var a = this.vwr.ms.at[iatom]; +var c = this.constraint; +var minv = null; +if (c == null) { +c = this.setConstraint(sym, iatom, J.modelkit.ModelKit.GET_CREATE); +if (c.type == 6) { +iatom = -1; +} else { +var b = this.getBasisAtom(iatom); +if (a !== b) { +var m = J.modelkit.ModelKit.getTransform(sym, a, b); +if (m == null) { +System.err.println("ModelKit - null matrix for " + iatom + " " + a + " to " + b); +iatom = -1; +} else { +if (!doAssign) { +minv = JU.M4.newM4(m); +minv.invert(); +}iatom = b.i; +var p = JU.P3.newP(ptNew); +sym.toFractional(p, false); +m.rotTrans(p); +sym.toCartesian(p, false); +ptNew.setT(p); +}}if (iatom >= 0) c.constrain(b, ptNew, allowProjection); +}} else { +c.constrain(a, ptNew, allowProjection); +}if (iatom >= 0 && !Float.isNaN(ptNew.x)) { +if (!doAssign) { +if (minv != null) { +var p = JU.P3.newP(ptNew); +sym.toFractional(p, false); +minv.rotTrans(p); +sym.toCartesian(p, false); +ptNew.setP(p); +}return bsMoved; +}if (this.assignMoveAtom(iatom, ptNew, bsFixed, bsModelAtoms, bsMoved) == 0) bsMoved = null; +}ptNew.x = NaN; +return bsMoved; +}, "~N,JU.BS,JU.BS,JU.P3,~B,~B,JU.BS"); +Clazz.defineMethod(c$, "promptUser", +function(msg, def){ +return this.vwr.prompt(msg, def, null, false); +}, "~S,~S"); +Clazz.defineMethod(c$, "resetBondFields", +function(){ +this.bsRotateBranch = null; +this.branchAtomIndex = this.bondAtomIndex1 = this.bondAtomIndex2 = -1; +}); +Clazz.defineMethod(c$, "rotateAtoms", +function(bsAtoms, points, endDegrees){ +var center = points[0]; +var p = new JU.P3(); +var i0 = bsAtoms.nextSetBit(0); +var sg = this.getSym(i0); +var bsAU = new JU.BS(); +var bsToMove = new JU.BS(); +for (var i = i0; i >= 0; i = bsAtoms.nextSetBit(i + 1)) { +var bai = this.getBasisAtom(i).i; +if (bsAU.get(bai)) { +continue; +}if (this.setConstraint(sg, bai, J.modelkit.ModelKit.GET_CREATE).type == 6) { +return 0; +}bsAU.set(bai); +bsToMove.set(i); +} +var nAtoms = bsAtoms.cardinality(); +var apos0 = this.vwr.ms.saveAtomPositions(); +var m = JU.Quat.newVA(JU.V3.newVsub(points[1], points[0]), endDegrees).getMatrix(); +var vt = new JU.V3(); +var apos = new Array(nAtoms); +for (var ip = 0, i = i0; i >= 0; i = bsAtoms.nextSetBit(i + 1)) { +var a = this.vwr.ms.at[i]; +p = apos[ip++] = JU.P3.newP(a); +vt.sub2(p, center); +m.rotate(vt); +p.add2(center, vt); +this.setConstraint(sg, i, J.modelkit.ModelKit.GET_CREATE).constrain(a, p, false); +if (Float.isNaN(p.x)) return 0; +} +nAtoms = 0; +var bsFixed = this.vwr.getMotionFixedAtoms(sg, null); +var bsModelAtoms = this.vwr.getModelUndeletedAtomsBitSet(this.vwr.ms.at[i0].mi); +var bsMoved = new JU.BS(); +for (var ip = 0, i = i0; i >= 0; i = bsToMove.nextSetBit(i + 1), ip++) { +nAtoms += this.assignMoveAtom(i, apos[ip], bsFixed, bsModelAtoms, bsMoved); +} +var bs = JU.BSUtil.copy(bsAtoms); +bs.andNot(bsToMove); +return (this.checkAtomPositions(apos0, apos, bs) ? nAtoms : 0); +}, "JU.BS,~A,~N"); +Clazz.defineMethod(c$, "runScriptBuffered", +function(script){ +var sb = new JU.SB(); +try { +(this.vwr.eval).runBufferedSafely(script, sb); +} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +e.printStackTrace(); +} else { +throw e; +} +} +return sb.toString(); +}, "~S"); +Clazz.defineMethod(c$, "setBondIndex", +function(index, isRotate){ +if (!isRotate && this.vwr.isModelkitPickingRotateBond()) { +this.setProperty("rotatebondindex", Integer.$valueOf(index)); +return; +}var haveBond = (this.bondIndex >= 0); +if (!haveBond && index < 0) return; +if (index < 0) { +this.resetBondFields(); +return; +}this.bsRotateBranch = null; +this.branchAtomIndex = -1; +this.bondIndex = index; +this.isRotateBond = isRotate; +this.bondAtomIndex1 = this.vwr.ms.bo[index].getAtomIndex1(); +this.bondAtomIndex2 = this.vwr.ms.bo[index].getAtomIndex2(); +this.menu.setActiveMenu("bondMenu"); +}, "~N,~B"); +Clazz.defineMethod(c$, "setBranchAtom", +function(atomIndex, isClick){ +var isBondedAtom = (atomIndex == this.bondAtomIndex1 || atomIndex == this.bondAtomIndex2); +if (isBondedAtom) { +this.branchAtomIndex = atomIndex; +this.bsRotateBranch = null; +} else { +this.bsRotateBranch = null; +this.branchAtomIndex = -1; +}}, "~N,~B"); +Clazz.defineMethod(c$, "setDefaultState", +function(mode){ +if (!this.hasUnitCell) mode = 0; +if (!this.hasUnitCell || this.isXtalState() != this.hasUnitCell) { +this.setMKState(mode); +switch (mode) { +case 0: +break; +case 1: +if (this.getSymViewState() == 0) this.setSymViewState(8); +break; +case 2: +break; +} +}}, "~N"); +Clazz.defineMethod(c$, "isElementKeyOn", +function(modelIndex){ +var data = Clazz.newArray(-1, [J.modelkit.ModelKit.getElementKey(modelIndex) + "*", null]); +this.vwr.shm.getShapePropertyData(31, "checkID", data); +return (data[1] != null); +}, "~N"); +Clazz.defineMethod(c$, "updateElementKeyFromStateScript", +function(){ +for (var i = this.vwr.ms.mc; --i >= 0; ) { +if (this.isElementKeyOn(i)) { +this.bsElementKeyModels.set(i); +this.haveElementKeys = true; +}} +}); +Clazz.defineMethod(c$, "setElementKey", +function(modelIndex, isOn){ +if (isOn && (modelIndex >= 0 && this.bsElementKeyModels.get(modelIndex))) return; +this.clearElementKey(modelIndex); +if (!isOn || modelIndex < 0) return; + new J.modelkit.ModelKit.EKey(this.vwr, modelIndex).draw(this.vwr); +this.bsElementKeyModels.set(modelIndex); +this.haveElementKeys = true; +}, "~N,~B"); +Clazz.defineMethod(c$, "setSymEdit", +function(bits){ +this.state = (this.state & -225) | bits; +}, "~N"); +Clazz.defineMethod(c$, "setSymViewState", +function(bits){ +this.state = (this.state & -29) | bits; +}, "~N"); +Clazz.defineMethod(c$, "setUnitCell", +function(bits){ +this.state = (this.state & -1793) | bits; +}, "~N"); +Clazz.defineMethod(c$, "showSymop", +function(symop){ +this.secondAtomIndex = -1; +this.symop = symop; +this.showXtalSymmetry(); +}, "~O"); +Clazz.defineMethod(c$, "showXtalSymmetry", +function(){ +var script = null; +switch (this.getSymViewState()) { +case 0: +script = "draw * delete"; +break; +case 8: +default: +var offset = null; +if (this.secondAtomIndex >= 0) { +script = "draw ID sym symop " + (this.centerAtomIndex < 0 ? this.centerPoint : " {atomindex=" + this.centerAtomIndex + "}") + " {atomindex=" + this.secondAtomIndex + "}"; +} else { +offset = this.viewOffset; +if (this.symop == null) this.symop = Integer.$valueOf(1); +var iatom = (this.centerAtomIndex >= 0 ? this.centerAtomIndex : this.centerPoint != null ? -1 : this.iatom0); +script = "draw ID sym symop " + (this.symop == null ? "1" : (typeof(this.symop)=='string') ? "'" + this.symop + "'" : JU.PT.toJSON(null, this.symop)) + (iatom < 0 ? this.centerPoint : " {atomindex=" + iatom + "}") + (offset == null ? "" : " offset " + offset); +}this.drawData = this.runScriptBuffered(script); +this.drawScript = script; +this.drawData = (this.showSymopInfo ? this.drawData.substring(0, this.drawData.indexOf("\n") + 1) : ""); +this.appRunScript(";refresh;set echo top right;echo " + this.drawData.$replace('\t', ' ')); +break; +} +}); +Clazz.defineMethod(c$, "updateElementKey", +function(bsAtoms){ +if (bsAtoms == null) { +this.updateModelElementKey(this.vwr.am.cmi, true); +return; +}if (bsAtoms.cardinality() == 1) { +this.updateModelElementKey(this.vwr.ms.at[bsAtoms.nextSetBit(0)].mi, true); +return; +}for (var i = this.vwr.ms.mc; --i >= 0; ) { +if (this.vwr.ms.am[i].bsAtoms.intersects(bsAtoms)) { +this.updateModelElementKey(i, true); +}} +}, "JU.BS"); +Clazz.defineMethod(c$, "updateModelElementKeys", +function(bsModels, forceNew){ +if (bsModels == null) bsModels = JU.BSUtil.newBitSet2(0, this.vwr.ms.mc); +for (var i = bsModels.nextSetBit(0); i >= 0; i = bsModels.nextSetBit(i + 1)) { +this.updateModelElementKey(i, forceNew); +} +}, "JU.BS,~B"); +Clazz.defineMethod(c$, "updateModelElementKey", +function(modelIndex, forceNew){ +if (this.doUpdateElementKey(modelIndex)) { +if (forceNew) this.clearElementKey(modelIndex); +this.setElementKey(modelIndex, true); +}}, "~N,~B"); +Clazz.defineMethod(c$, "doUpdateElementKey", +function(modelIndex){ +return modelIndex >= 0 && !this.vwr.ms.isJmolDataFrameForModel(modelIndex) && !this.bsElementKeyModelsOFF.get(modelIndex) && (this.$setElementKeys || this.bsElementKeyModels.get(modelIndex) || this.isElementKeyOn(modelIndex)); +}, "~N"); +Clazz.defineMethod(c$, "setElementKeys", +function(isOn){ +this.$setElementKeys = isOn; +if (isOn) { +this.clearElementKeysOFF(); +}this.clearElementKey(-1); +if (isOn) { +this.updateModelElementKeys(null, false); +}}, "~B"); +Clazz.defineMethod(c$, "clearElementKeysOFF", +function(){ +this.bsElementKeyModelsOFF.clearAll(); +}); +Clazz.defineMethod(c$, "transformAtomsToUnitCell", +function(sym, oabc, ucname){ +var bsAtoms = this.vwr.getThisModelAtoms(); +var n = bsAtoms.cardinality(); +var isReset = (sym == null || n == 0); +if (!isReset) { +var a = this.vwr.ms.at; +var fxyz = this.getFractionalCoordinates(sym, bsAtoms); +this.vwr.ms.setModelCagePts(-1, oabc, ucname); +sym = this.vwr.getCurrentUnitCell(); +for (var j = bsAtoms.nextSetBit(0), k = 0; j >= 0; j = bsAtoms.nextSetBit(j + 1), k++) { +a[j].setT(fxyz[k]); +this.vwr.toCartesianUC(sym, a[j], false); +} +this.vwr.ms.setTaintedAtoms(bsAtoms, 2); +}return isReset; +}, "J.api.SymmetryInterface,~A,~S"); +Clazz.defineMethod(c$, "getFractionalCoordinates", +function(sym, bsAtoms){ +var n = bsAtoms.cardinality(); +var a = this.vwr.ms.at; +var fxyz = new Array(n); +for (var j = bsAtoms.nextSetBit(0), k = 0; j >= 0; j = bsAtoms.nextSetBit(j + 1), k++) { +fxyz[k] = JU.P3.newP(a[j]); +this.vwr.toFractionalUC(sym, fxyz[k], false); +} +return fxyz; +}, "J.api.SymmetryInterface,JU.BS"); +Clazz.defineMethod(c$, "updateDrawAtomSymmetry", +function(mode, atoms){ +if (this.drawAtomSymmetry == null) return; +var cmd = ""; +for (var i = this.drawAtomSymmetry.size(); --i >= 0; ) { +var a = this.drawAtomSymmetry.get(i); +if (mode === "deleteModelAtoms" ? atoms.get(a.bsAtoms.nextSetBit(0)) : atoms.intersects(a.bsAtoms)) { +switch (mode) { +case "deleteModelAtoms": +case "atomsDeleted": +System.out.println("remove deleteatoms " + atoms + " " + a.bsAtoms + a.id); +this.drawAtomSymmetry.removeItemAt(i); +break; +case "atomsMoved": +try { +if (!this.checkDrawID(a.id)) { +this.drawAtomSymmetry.removeItemAt(i); +} else { +cmd += a.cmd + "#quiet" + "\n"; +}} catch (e) { +if (Clazz.exceptionOf(e, Exception)){ +e.printStackTrace(); +} else { +throw e; +} +} +break; +} +if (this.drawAtomSymmetry.size() == 0) this.drawAtomSymmetry = null; +}if (cmd.length > 0) this.vwr.evalStringGUI(cmd); +} +}, "~S,JU.BS"); +Clazz.defineMethod(c$, "checkDrawID", +function(id){ +var o = Clazz.newArray(-1, [id + "*", null]); +var exists = this.vwr.shm.getShapePropertyData(22, "checkID", o); +return (exists && o[1] != null); +}, "~S"); +Clazz.defineMethod(c$, "drawSymop", +function(a1, a2){ +var s = "({" + a1 + "}) ({" + a2 + "}) "; +var cmd = "draw ID 'sym' symop " + s; +this.vwr.evalStringGUI(cmd); +}, "~N,~N"); +Clazz.defineMethod(c$, "addAtomSet", +function(data){ +var tokens = JU.PT.split(data, "|"); +var id = tokens[0]; +this.clearAtomSets(id); +var a1 = JU.PT.parseInt(tokens[1]); +var a2 = JU.PT.parseInt(tokens[2]); +var cmd = tokens[3]; +var bs = JU.BSUtil.newAndSetBit(a1); +bs.set(a2); +if (this.drawAtomSymmetry == null) { +this.drawAtomSymmetry = new JU.Lst(); +}this.drawAtomSymmetry.addLast(Clazz.innerTypeInstance(J.modelkit.ModelKit.DrawAtomSet, this, null, bs, id, cmd)); +}, "~S"); +Clazz.defineMethod(c$, "clearAtomSets", +function(id){ +if (this.drawAtomSymmetry == null) return; +for (var i = this.drawAtomSymmetry.size(); --i >= 0; ) { +var a = this.drawAtomSymmetry.get(i); +if (a.id.equals(id)) { +this.drawAtomSymmetry.remove(i); +return; +}} +}, "~S"); +Clazz.defineMethod(c$, "drawUnitCell", +function(id, ucLattice, swidth){ +var sym = this.vwr.getOperativeSymmetry(); +if (sym == null) return; +var uc = this.vwr.getSymTemp().getUnitCell(sym.getUnitCellVectors(), false, "draw"); +uc.setOffsetPt(ucLattice); +var cellRange = Clazz.newArray(-1, [ new JU.P3(), new JU.P3()]); +var s = ""; +if (id == null) id = "uclat"; +var val = Clazz.newArray(-1, [ Clazz.newArray(-1, ["thisID", id + "*"]), Clazz.newArray(-1, ["delete", null])]); +this.vwr.shm.setShapeProperties(22, val); +JU.SimpleUnitCell.getCellRange(ucLattice, cellRange); +for (var p = 1, x = Clazz.floatToInt(cellRange[0].x); x < cellRange[1].x; x++) { +for (var y = Clazz.floatToInt(cellRange[0].y); y < cellRange[1].y; y++) { +for (var z = Clazz.floatToInt(cellRange[0].z); z < cellRange[1].z; z++, p++) { +s += "\ndraw ID " + JU.PT.esc(id + "_" + p) + " " + swidth + " unitcell \"a,b,c;" + x + "," + y + "," + z + "\""; +} +} +} +s += this.getDrawAxes(id, swidth); +this.appRunScript(s); +}, "~S,JU.T3,~S"); +Clazz.defineMethod(c$, "drawAxes", +function(id, swidth){ +var s = this.getDrawAxes(id, swidth); +if (s.length > 0) this.appRunScript(s); +}, "~S,~S"); +Clazz.defineMethod(c$, "getDrawAxes", +function(id, swidth){ +if (this.vwr.g.axesMode != 603979808 || this.vwr.shm.getShapePropertyIndex(34, "axesTypeXY", 0) === Boolean.TRUE) return ""; +if (id == null) id = "uca"; +if (swidth.indexOf(".") > 0) swidth += "05"; +var origin = this.vwr.shm.getShapePropertyIndex(34, "originPoint", 0); +var axisPoints = this.vwr.shm.getShapePropertyIndex(34, "axisPoints", 0); +var s = ""; +var colors = Clazz.newArray(-1, ["red", "green", "blue"]); +for (var i = 0, a = 6; i < 3; i++, a++) { +s += "\ndraw ID " + JU.PT.esc(id + "_axis_" + JV.JC.axisLabels[a]) + " " + swidth + " line " + origin + " " + axisPoints[i] + " color " + colors[i]; +} +return s; +}, "~S,~S"); +Clazz.defineMethod(c$, "drawSymmetry", +function(thisId, isSymop, iatom, xyz, iSym, trans, center, target, intScale, nth, options, opList, isModelkit){ +var s = null; +if (options != 0) { +var o = this.vwr.getSymmetryInfo(iatom, xyz, iSym, trans, center, target, 134217751, null, intScale / 100, nth, options, opList); +if (Clazz.instanceOf(o,"JU.P3")) target = o; + else s = ""; +}if (thisId == null) thisId = (isSymop ? "sym" : "sg"); +if (s == null) s = this.vwr.getSymmetryInfo(iatom, xyz, iSym, trans, center, target, 135176, thisId, Clazz.doubleToInt(intScale / 100), nth, options, opList); +if (s != null) { +s = "draw ID " + (isSymop ? "sg" : "sym") + "* delete;" + s; +s = "draw ID " + thisId + "* delete;" + s; +}if (isModelkit) s += ";draw ID sg_xes axes 0.05;"; +return s; +}, "~S,~B,~N,~S,~N,JU.P3,JU.P3,JU.P3,~N,~N,~N,~A,~B"); +c$.$ModelKit$DrawAtomSet$ = function(){ +/*if4*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +Clazz.prepareCallback(this, arguments); +this.bsAtoms = null; +this.cmd = null; +this.id = null; +Clazz.instantialize(this, arguments);}, J.modelkit.ModelKit, "DrawAtomSet", null); +Clazz.makeConstructor(c$, +function(bs, id, cmd){ +this.bsAtoms = bs; +this.cmd = cmd; +this.id = id; +}, "JU.BS,~S,~S"); +/*eoif4*/})(); +}; +/*if3*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.name = null; +this.setting = null; +this.myTrm = null; +this.myIta = null; +this.isITA = false; +this.isHM = false; +this.hallSymbol = null; +this.errString = null; +this.trLink = null; +this.index = 0; +this.calcNext = null; +this.calculated = null; +Clazz.instantialize(this, arguments);}, J.modelkit.ModelKit, "ClegNode", null); +Clazz.makeConstructor(c$, +function(index, name, setting){ +if (name == null) return; +this.index = index; +this.setting = (setting == null ? "a,b,c" : setting); +var pt; +this.isITA = name.startsWith("ITA/"); +if (this.isITA) { +name = name.substring(4); +}this.isHM = false; +this.hallSymbol = null; +if (name.charAt(0) == '[') { +pt = name.indexOf(']'); +if (pt < 0) { +this.errString = "invalid Hall symbol: " + name + "!"; +return; +}this.hallSymbol = name.substring(1, pt); +name = "Hall:" + this.hallSymbol; +} else if (name.startsWith("HM:")) { +this.isHM = true; +} else if (name.length <= 3) { +this.isITA = true; +for (var i = name.length; --i >= 0; ) { +if (!JU.PT.isDigit(name.charAt(i))) { +this.isITA = false; +break; +}} +if (this.isITA) { +name += ".1"; +}}if (!this.isITA && this.hallSymbol == null && !this.isHM) { +pt = (JU.PT.isDigit(name.charAt(0)) ? name.indexOf(" ") : -1); +if (pt > 0) name = name.substring(0, pt); +if (name.indexOf('.') > 0 && !Float.isNaN(JU.PT.parseFloat(name))) { +this.isITA = true; +if (!name.endsWith(".1") && setting != null) { +this.errString = "Space group ITA/" + name + " n.m syntax cannot be used with a setting!"; +return; +}}}this.name = name; +}, "~N,~S,~S"); +Clazz.defineMethod(c$, "addTransform", +function(trm){ +if (this.trLink == null) { +this.trLink = new JU.M4(); +this.trLink.setIdentity(); +}this.trLink.mul(trm); +}, "JU.M4"); +Clazz.defineMethod(c$, "update", +function(vwr, prevNode, trm, trTemp, sym){ +if (this.errString != null) return false; +if (this.name == null) return true; +if (this.isITA) { +this.myTrm = (this.name.endsWith(".1") ? "a,b,c" : sym.getITASettingValue(vwr, this.name, "trm")); +if (this.myTrm == null) { +this.errString = "Unknown ITA setting: " + this.name + "!"; +return false; +}var tokens = JU.PT.split(this.name, "."); +this.myIta = tokens[0]; +this.name = "ITA/" + this.myIta + ":" + (this.myTrm == null || this.myTrm.equals("a,b,c") ? this.setting : this.myTrm); +} else if (this.hallSymbol != null) { +if (sym.getSpaceGroupInfoObj("nameToXYZList", "Hall:" + this.hallSymbol, false, false) == null) { +this.errString = "Invalid Hall notation: " + this.hallSymbol; +return false; +}var pt = this.hallSymbol.indexOf("("); +if (pt > 0) { +var vabc = JU.PT.split(this.hallSymbol.substring(pt + 1, this.hallSymbol.length - 1), " "); +this.hallSymbol = this.hallSymbol.substring(0, pt).trim(); +var v = JU.P3.new3(-JU.PT.parseFloat(vabc[0]) / 12, -JU.PT.parseFloat(vabc[1]) / 12, -JU.PT.parseFloat(vabc[2]) / 12); +this.setting = "a,b,c;" + sym.staticToRationalXYZ(v, ","); +}this.name = "[" + this.hallSymbol + "]" + (this.setting.equals("a,b,c") ? "" : ":" + this.setting); +} else { +this.myTrm = sym.getSpaceGroupInfoObj("itaTransform", this.name, false, false); +this.myIta = sym.getSpaceGroupInfoObj("itaNumber", this.name, false, false); +}var trm0 = null; +var haveCalc = false; +var haveReferenceCell = (prevNode != null && this.trLink == null && (this.hallSymbol != null || this.myIta != null && (this.myIta.equals(prevNode.myIta) || prevNode.calcNext != null))); +if (haveReferenceCell) { +trm0 = JU.M4.newM4(trm); +if (prevNode != null && prevNode.myTrm != null) { +J.modelkit.ModelKit.addSGTransform(sym, "!" + prevNode.setting, trm, trTemp); +J.modelkit.ModelKit.addSGTransform(sym, "!" + prevNode.myTrm, trm, trTemp); +}var trCalc = null; +if (prevNode.calcNext != null) { +var isSub = true; +var isImplicit = false; +switch (prevNode.calcNext) { +case "super": +isSub = false; +break; +case "sub": +break; +case "": +case "set": +prevNode.calcNext = "set"; +isImplicit = true; +break; +} +var ita1 = JU.PT.parseInt(prevNode.myIta); +var ita2 = JU.PT.parseInt(this.myIta); +var isSetting = (isImplicit && ita1 == ita2); +if (!isSetting) { +trCalc = sym.getSubgroupJSON(vwr, (isSub ? ita1 : ita2), (isSub ? ita2 : ita1), 0, 1); +haveCalc = (trCalc != null); +if (haveCalc && !isSub) trCalc = "!" + trCalc; +var calc = prevNode.myIta + ">" + trCalc + ">" + this.myIta; +if (!haveCalc) throw new RuntimeException(calc); +System.out.println("sub := " + calc); +J.modelkit.ModelKit.addSGTransform(sym, trCalc, trm, trTemp); +}}J.modelkit.ModelKit.addSGTransform(sym, this.myTrm, trm, trTemp); +J.modelkit.ModelKit.addSGTransform(sym, this.setting, trm, trTemp); +System.out.println("ClegNode " + this + "\n" + trm); +if (haveCalc) { +trm0.invert(); +var trm1 = JU.M4.newM4(trm); +trm1.mul(trm0); +this.calculated = sym.convertTransform(null, trm1); +}}return true; +}, "JV.Viewer,J.modelkit.ModelKit.ClegNode,JU.M4,JU.M4,J.api.SymmetryInterface"); +Clazz.overrideMethod(c$, "toString", +function(){ +return "[ClegNode #" + this.index + " " + this.name + " " + this.myIta + ":" + this.setting + " " + this.myTrm + "]"; +}); +c$.checkSyntax = Clazz.defineMethod(c$, "checkSyntax", +function(tokens, sym){ +for (var i = 0; i < tokens.length; i++) { +var s = tokens[i].trim(); +if (s.length == 0) continue; +var pt = s.indexOf(":"); +var transform; +if (pt > 0) { +transform = s.substring(pt + 1); +s = s.substring(0, pt); +} else if (s.indexOf(",") >= 0) { +transform = s; +s = null; +} else { +transform = ""; +}if (s != null) { +var itno = JU.PT.parseFloatStrict(s); +if (itno < 1 || itno >= 231) return false; +if (Float.isNaN(itno)) transform = s; +}switch (transform) { +case "": +case "sub": +case "r": +case "h": +case "!r": +case "!h": +break; +default: +if (transform.indexOf(",") >= 0) { +if ((sym.convertTransform(transform, null)).determinant3() == 0) return false; +}break; +} +} +return true; +}, "~A,J.api.SymmetryInterface"); +Clazz.defineMethod(c$, "updateTokens", +function(tokens, i){ +if (this.myIta != null && this.myTrm != null) tokens[i] = this.myIta + (this.myTrm.equals("a,b,c") ? "" : ":" + this.myTrm); +if (this.calculated != null) tokens[i - 1] = this.calculated; +}, "~A,~N"); +/*eoif3*/})(); +/*if3*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.type = 0; +this.pt = null; +this.offset = null; +this.plane = null; +this.unitVector = null; +Clazz.instantialize(this, arguments);}, J.modelkit.ModelKit, "Constraint", null); +Clazz.makeConstructor(c$, +function(pt, type, params){ +this.pt = pt; +this.type = type; +switch (type) { +case 0: +case 7: +case 6: +break; +case 4: +this.offset = params[0]; +this.unitVector = JU.V3.newV(params[1]); +this.unitVector.normalize(); +break; +case 5: +this.plane = params[0]; +break; +default: +throw new IllegalArgumentException(); +} +}, "JU.P3,~N,~A"); +Clazz.defineMethod(c$, "constrain", +function(ptOld, ptNew, allowProjection){ +var v = new JU.V3(); +var p = JU.P3.newP(ptOld); +var d = 0; +switch (this.type) { +case 0: +return; +case 7: +return; +case 6: +ptNew.x = NaN; +return; +case 4: +if (this.pt == null) { +d = JU.Measure.projectOntoAxis(p, this.offset, this.unitVector, v); +if (d * d >= 1.96E-6) { +ptNew.x = NaN; +break; +}}d = JU.Measure.projectOntoAxis(ptNew, this.offset, this.unitVector, v); +break; +case 5: +if (this.pt == null) { +if (Math.abs(JU.Measure.getPlaneProjection(p, this.plane, v, v)) > 0.01) { +ptNew.x = NaN; +break; +}}d = JU.Measure.getPlaneProjection(ptNew, this.plane, v, v); +ptNew.setT(v); +break; +} +if (!allowProjection && Math.abs(d) > 1e-10) { +ptNew.x = NaN; +}}, "JU.P3,JU.P3,~B"); +/*eoif3*/})(); +/*if3*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.bsElements = null; +this.nAtoms = 0; +this.elementStrings = null; +this.colors = null; +this.isotopeCounts = null; +this.modelIndex = 0; +Clazz.instantialize(this, arguments);}, J.modelkit.ModelKit, "EKey", null); +Clazz.prepareFields (c$, function(){ +this.bsElements = new JU.BS(); +this.elementStrings = Clazz.newArray(120, 10, null); +this.colors = Clazz.newIntArray (120, 10, 0); +this.isotopeCounts = Clazz.newIntArray (120, 0); +}); +Clazz.makeConstructor(c$, +function(vwr, modelIndex){ +var bsAtoms = vwr.getModelUndeletedAtomsBitSet(modelIndex); +this.nAtoms = (bsAtoms == null ? 0 : bsAtoms.cardinality()); +this.modelIndex = modelIndex; +if (this.nAtoms == 0) return; +var a = vwr.ms.at; +for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) { +var elem = a[i].getElementSymbol(); +var elemno = a[i].getElementNumber(); +var color = a[i].atomPropertyInt(1765808134); +var j = 0; +var niso = this.isotopeCounts[elemno]; +for (; j < niso; j++) { +if (this.elementStrings[elemno][j].equals(elem)) { +if (this.colors[elemno][j] != color) { +this.nAtoms = 0; +return; +}break; +}} +if (j < niso) { +continue; +}this.bsElements.set(elemno); +this.isotopeCounts[elemno]++; +this.elementStrings[elemno][j] = elem; +this.colors[elemno][j] = color; +} +}, "JV.Viewer,~N"); +Clazz.defineMethod(c$, "draw", +function(vwr){ +if (this.nAtoms == 0) return; +var key = J.modelkit.ModelKit.getElementKey(this.modelIndex); +var h = vwr.getScreenHeight(); +var font = vwr.getFont3D("SansSerif", "Bold", Clazz.doubleToInt(h * 20 / 400)); +for (var y = 90, elemno = this.bsElements.nextSetBit(0); elemno >= 0; elemno = this.bsElements.nextSetBit(elemno + 1)) { +var n = this.isotopeCounts[elemno]; +if (n == 0) continue; +var elem = this.elementStrings[elemno]; +for (var j = 0; j < n; j++) { +var label = elem[j]; +var color = this.colors[elemno][j]; +vwr.shm.setShapeProperties(22, [ Clazz.newArray(-1, ["init", "elementKey"]), Clazz.newArray(-1, ["thisID", key + "d_" + label]), Clazz.newArray(-1, ["diameter", Float.$valueOf(2)]), Clazz.newArray(-1, ["modelIndex", Integer.$valueOf(this.modelIndex)]), Clazz.newArray(-1, ["points", Integer.$valueOf(0)]), Clazz.newArray(-1, ["coord", JU.P3.new3(90, y, -3.4028235E38)]), Clazz.newArray(-1, ["set", null]), Clazz.newArray(-1, ["color", Integer.$valueOf(color)]), Clazz.newArray(-1, ["thisID", null])]); +vwr.shm.setShapeProperties(31, [ Clazz.newArray(-1, ["thisID", null]), Clazz.newArray(-1, ["target", key + "e_" + label]), Clazz.newArray(-1, ["model", Integer.$valueOf(this.modelIndex)]), Clazz.newArray(-1, ["xypos", JU.P3.new3(91, y - 2, -3.4028235E38)]), Clazz.newArray(-1, ["text", label]), Clazz.newArray(-1, ["font", font]), Clazz.newArray(-1, ["color", Integer.$valueOf(-74566)]), Clazz.newArray(-1, ["thisID", null])]); +y -= 5; +} +} +var bs = vwr.getVisibleFramesBitSet(); +vwr.shm.getShape(22).setModelVisibilityFlags(bs); +vwr.shm.getShape(31).setModelVisibilityFlags(bs); +}, "JV.Viewer"); +/*eoif3*/})(); +/*if3*/;(function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.oldVib = null; +this.atom = null; +this.t = 0; +this.baseAtom = null; +this.pt0 = null; +this.ptf = null; +this.sym = null; +this.c = null; +Clazz.instantialize(this, arguments);}, J.modelkit.ModelKit, "WyckoffModulation", JU.Vibration); +Clazz.prepareFields (c$, function(){ +this.pt0 = new JU.P3(); +this.ptf = new JU.P3(); +}); +Clazz.makeConstructor(c$, +function(sym, c, atom, baseAtom){ +Clazz.superConstructor (this, J.modelkit.ModelKit.WyckoffModulation, []); +this.setType(-3); +this.sym = sym; +this.c = c; +this.atom = atom; +this.baseAtom = baseAtom; +this.x = 1; +}, "J.api.SymmetryInterface,J.modelkit.ModelKit.Constraint,JM.Atom,JM.Atom"); +c$.setVibrationMode = Clazz.defineMethod(c$, "setVibrationMode", +function(mk, value){ +var atoms = mk.vwr.ms.at; +var bsAtoms = mk.vwr.getThisModelAtoms(); +if (("off").equals(value)) { +for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) { +var v = atoms[i].getVibrationVector(); +if (v != null && v.modDim != -3) continue; +mk.vwr.ms.setVibrationVector(i, (v).oldVib); +} +} else if (("wyckoff").equals(value)) { +for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) { +var v = atoms[i].getVibrationVector(); +if (v != null && v.modDim != -3) continue; +var sym = mk.getSym(i); +var wv = null; +if (sym != null) { +var c = mk.setConstraint(sym, i, J.modelkit.ModelKit.GET_CREATE); +if (c.type != 6) wv = new J.modelkit.ModelKit.WyckoffModulation(sym, c, atoms[i], mk.getBasisAtom(i)); +}mk.vwr.ms.setVibrationVector(i, wv); +} +}mk.vwr.setVibrationPeriod(NaN); +}, "J.modelkit.ModelKit,~O"); +Clazz.overrideMethod(c$, "setCalcPoint", +function(pt, t456, scale, modulationScale){ +var v = this.baseAtom.getVibrationVector(); +if (v == null || v.modDim != -3) return pt; +var wv = (v); +if (this.sym == null) return pt; +var m = null; +if (wv.atom !== this.atom) { +m = J.modelkit.ModelKit.getTransform(this.sym, wv.atom, this.atom); +if (m == null) return pt; +}if (wv.t != t456.x && (Clazz.floatToInt(t456.x * 10)) % 2 == 0) { +if (this.c.type != 6) { +wv.setPos(this.sym, this.c, scale); +}wv.t = t456.x; +}if (m == null) pt.setT(wv.ptf); + else m.rotTrans2(wv.ptf, pt); +this.sym.toCartesian(pt, false); +return pt; +}, "JU.T3,JU.T3,~N,~N"); +Clazz.defineMethod(c$, "setPos", +function(sym, c, scale){ +this.x = (Math.random() - 0.5) / 10 * scale; +this.y = (Math.random() - 0.5) / 10 * scale; +this.z = (Math.random() - 0.5) / 10 * scale; +this.pt0.setT(this.atom); +this.ptf.setT(this.pt0); +this.ptf.add(this); +c.constrain(this.pt0, this.ptf, true); +sym.toFractional(this.ptf, false); +}, "J.api.SymmetryInterface,J.modelkit.ModelKit.Constraint,~N"); +/*eoif3*/})(); +c$.locked = new J.modelkit.ModelKit.Constraint(null, 6, null); +c$.none = new J.modelkit.ModelKit.Constraint(null, 0, null); +c$.Pt000 = new JU.P3(); +c$.GET = 0; +c$.GET_CREATE = 1; +c$.GET_DELETE = 2; +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/modelkit/ModelKitPopup.js b/config/plugins/visualizations/jmol/static/j2s/J/modelkit/ModelKitPopup.js new file mode 100755 index 000000000000..908b47844458 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/modelkit/ModelKitPopup.js @@ -0,0 +1,221 @@ +Clazz.declarePackage("J.modelkit"); +Clazz.load(["J.popup.JmolGenericPopup", "J.modelkit.ModelKitPopupResourceBundle"], "J.modelkit.ModelKitPopup", ["J.i18n.GT"], function(){ +var c$ = Clazz.decorateAsClass(function(){ +this.modelkit = null; +this.hidden = false; +this.allowPopup = true; +this.activeMenu = null; +this.bondRotationCheckBox = null; +this.prevBondCheckBox = null; +this.bondRotationName = ".modelkitMenu.bondMenu.rotateBondP!RD"; +this.haveOperators = false; +Clazz.instantialize(this, arguments);}, J.modelkit, "ModelKitPopup", J.popup.JmolGenericPopup); +Clazz.makeConstructor(c$, +function(){ +Clazz.superConstructor (this, J.modelkit.ModelKitPopup, []); +}); +Clazz.overrideMethod(c$, "getBundle", +function(menu){ +return J.modelkit.ModelKitPopup.bundle; +}, "~S"); +Clazz.defineMethod(c$, "jpiShow", +function(x, y){ +if (!this.hidden) { +this.updateCheckBoxesForModelKit(null); +Clazz.superCall(this, J.modelkit.ModelKitPopup, "jpiShow", [x, y]); +}}, "~N,~N"); +Clazz.overrideMethod(c$, "jpiUpdateComputedMenus", +function(){ +this.htMenus.get("xtalMenu").setEnabled(this.modelkit.setHasUnitCell()); +if (this.modelkit.checkNewModel()) { +this.haveOperators = false; +this.updateOperatorMenu(); +}this.updateAllXtalMenuOptions(); +}); +Clazz.overrideMethod(c$, "appUpdateForShow", +function(){ +this.jpiUpdateComputedMenus(); +}); +Clazz.defineMethod(c$, "hidePopup", +function(){ +this.menuHidePopup(this.popupMenu); +}); +Clazz.defineMethod(c$, "clearLastModelSet", +function(){ +this.modelkit.lastModelSet = null; +}); +Clazz.defineMethod(c$, "updateOperatorMenu", +function(){ +if (this.haveOperators) return; +this.haveOperators = true; +var menu = this.htMenus.get("xtalOp!PersistMenu"); +if (menu != null) this.addAllCheckboxItems(menu, this.modelkit.getAllOperators()); +}); +Clazz.defineMethod(c$, "addAllCheckboxItems", +function(menu, labels){ +this.menuRemoveAll(menu, 0); +var subMenu = menu; +var pt = (labels.length > 32 ? 0 : -2147483648); +for (var i = 0; i < labels.length; i++) { +if (pt >= 0 && (pt++ % 32) == 0) { +var id = "mtsymop" + pt + "Menu"; +subMenu = this.menuNewSubMenu((i + 1) + "..." + Math.min(i + 32, labels.length), this.menuGetId(menu) + "." + id); +this.menuAddSubMenu(menu, subMenu); +this.htMenus.put(id, subMenu); +pt = 1; +}if (i == 0) this.menuEnable(this.menuCreateItem(subMenu, J.i18n.GT.$("none"), "draw sym_* delete", null), true); +var sym = labels[i]; +this.menuEnable(this.menuCreateItem(subMenu, sym, sym, subMenu.getName() + "." + "mkop_" + (i + 1)), true); +} +}, "J.api.SC,~A"); +Clazz.defineMethod(c$, "updateAllXtalMenuOptions", +function(){ +var text = ""; +switch (this.modelkit.getMKState()) { +case 0: +text = " (not enabled)"; +break; +case 1: +text = " (view)"; +break; +case 2: +text = " (edit)"; +break; +} +this.setLabel("xtalModePersistMenu", "Crystal Mode: " + text); +text = this.modelkit.getCenterText(); +this.setLabel("xtalSelPersistMenu", "Center: " + (text == null ? "(not selected)" : text)); +text = this.modelkit.getSymopText(); +this.setLabel("operator", text == null ? "(no operator selected)" : text); +switch (this.modelkit.getSymEditState()) { +case 0: +text = "do not apply symmetry"; +break; +case 64: +text = "retain local symmetry"; +break; +case 32: +text = "apply local symmetry"; +break; +case 128: +text = "apply full symmetry"; +break; +} +this.setLabel("xtalEditOptPersistMenu", "Edit option: " + text); +switch (this.modelkit.getUnitCellState()) { +case 0: +text = "packed"; +break; +case 256: +text = "unpacked" + (this.modelkit.viewOffset == null ? "(no view offset)" : "(view offset=" + this.modelkit.viewOffset + ")"); +break; +} +this.setLabel("xtalPackingPersistMenu", "Packing: " + text); +}); +Clazz.defineMethod(c$, "setLabel", +function(key, label){ +this.menuSetLabel(this.htMenus.get(key), label); +}, "~S,~S"); +Clazz.defineMethod(c$, "setActiveMenu", +function(name){ +var active = (name.indexOf("xtalMenu") >= 0 ? "xtalMenu" : name.indexOf("atomMenu") >= 0 ? "atomMenu" : name.indexOf("bondMenu") >= 0 ? "bondMenu" : null); +if (active != null) { +this.activeMenu = active; +if ((active === "xtalMenu") == (this.modelkit.getMKState() == 0)) this.modelkit.setMKState(active === "xtalMenu" ? 1 : 0); +this.vwr.refresh(1, "modelkit"); +if (active === "bondMenu" && this.prevBondCheckBox == null) this.prevBondCheckBox = this.htMenus.get("assignBond_pP!RD"); +} else if (name.indexOf("optionsMenu") >= 0) { +this.htMenus.get("undo").setEnabled(this.vwr.undoMoveAction(4165, 1275068425) > 0); +this.htMenus.get("redo").setEnabled(this.vwr.undoMoveAction(4140, 1275068425) > 0); +}return active; +}, "~S"); +Clazz.overrideMethod(c$, "appUpdateSpecialCheckBoxValue", +function(source, actionCommand, selected){ +if (source == null || !selected) return; +var name = source.getName(); +var mode; +if (!this.updatingForShow && (mode = this.setActiveMenu(name)) != null) { +var text = source.getText(); +if (mode === "bondMenu") { +if (name.equals(this.bondRotationName)) { +this.bondRotationCheckBox = source; +} else { +this.prevBondCheckBox = source; +}}this.modelkit.setHoverLabel(this.activeMenu, text); +}}, "J.api.SC,~S,~B"); +Clazz.defineMethod(c$, "exitBondRotation", +function(){ +this.modelkit.exitBondRotation(this.prevBondCheckBox == null ? null : this.prevBondCheckBox.getText()); +this.vwr.setPickingMode(null, 33); +if (this.bondRotationCheckBox != null) this.bondRotationCheckBox.setSelected(false); +if (this.prevBondCheckBox != null) this.prevBondCheckBox.setSelected(true); +}); +Clazz.overrideMethod(c$, "appGetBooleanProperty", +function(name){ +if (name.startsWith("mk")) { +return (this.modelkit.getProperty(name.substring(2))).booleanValue(); +}return this.vwr.getBooleanProperty(name); +}, "~S"); +Clazz.overrideMethod(c$, "getUnknownCheckBoxScriptToRun", +function(item, name, what, TF){ +if (name.startsWith("mk")) { +this.modelkit.processMKPropertyItem(name, TF); +return null; +}var element = this.modelkit.getElementFromUser(); +if (element == null) return null; +this.menuSetLabel(item, element); +item.setActionCommand("assignAtom_" + element + "P!:??"); +return "set picking assignAtom_" + element; +}, "J.api.SC,~S,~S,~B"); +Clazz.overrideMethod(c$, "menuFocusCallback", +function(name, actionCommand, gained){ +if (gained && !this.modelkit.processSymop(name, true)) { +this.setActiveMenu(name); +}}, "~S,~S,~B"); +Clazz.overrideMethod(c$, "menuClickCallback", +function(source, script){ +if (this.modelkit.processSymop(source.getName(), false)) return; +if (script.equals("clearQPersist")) { +for (var item, $item = this.htCheckbox.values().iterator (); $item.hasNext()&& ((item = $item.next ()) || true);) { +if (item.getActionCommand().indexOf(":??") < 0) continue; +this.menuSetLabel(item, "??"); +item.setActionCommand("_??P!:"); +} +this.appRunScript("set picking assignAtom_C"); +return; +}this.doMenuClickCallback(source, script); +}, "J.api.SC,~S"); +Clazz.overrideMethod(c$, "getScriptForCallback", +function(source, id, script){ +if (script.startsWith("mk")) { +this.modelkit.clickProcessXtal(id, script); +script = null; +}return script; +}, "J.api.SC,~S,~S"); +Clazz.defineMethod(c$, "appRunSpecialCheckBox", +function(item, basename, script, TF){ +if (basename.indexOf("assignAtom_Xx") == 0) { +this.modelkit.resetAtomPickType(); +}if (TF && !this.updatingForShow && basename.indexOf("Bond") < 0) { +this.updatingForShow = true; +this.exitBondRotation(); +this.updatingForShow = false; +}return Clazz.superCall(this, J.modelkit.ModelKitPopup, "appRunSpecialCheckBox", [item, basename, script, TF]); +}, "J.api.SC,~S,~S,~B"); +Clazz.defineMethod(c$, "updateCheckBoxesForModelKit", +function(menuName){ +var thisAtomType = "assignAtom_" + this.modelkit.pickAtomAssignType + "P"; +var thisBondType = "assignBond_" + this.modelkit.pickBondAssignType; +for (var entry, $entry = this.htCheckbox.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) { +var item = entry.getValue(); +var key = item.getActionCommand(); +if (key.startsWith(thisBondType) || key.startsWith(thisAtomType)) { +this.updatingForShow = true; +item.setSelected(false); +item.setSelected(true); +this.updatingForShow = false; +}} +}, "~S"); +c$.bundle = new J.modelkit.ModelKitPopupResourceBundle(null, null); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/modelkit/ModelKitPopupResourceBundle.js b/config/plugins/visualizations/jmol/static/j2s/J/modelkit/ModelKitPopupResourceBundle.js new file mode 100755 index 000000000000..bafd5306ea53 --- /dev/null +++ b/config/plugins/visualizations/jmol/static/j2s/J/modelkit/ModelKitPopupResourceBundle.js @@ -0,0 +1,28 @@ +Clazz.declarePackage("J.modelkit"); +Clazz.load(["J.popup.PopupResource"], "J.modelkit.ModelKitPopupResourceBundle", ["J.i18n.GT", "J.modelkit.ModelKit"], function(){ +var c$ = Clazz.declareType(J.modelkit, "ModelKitPopupResourceBundle", J.popup.PopupResource); +Clazz.overrideMethod(c$, "getMenuName", +function(){ +return "modelkitMenu"; +}); +Clazz.overrideMethod(c$, "buildStructure", +function(menuStructure){ +this.addItems(J.modelkit.ModelKitPopupResourceBundle.menuContents); +this.addItems(J.modelkit.ModelKitPopupResourceBundle.structureContents); +if (menuStructure != null) this.setStructure(menuStructure, new J.i18n.GT()); +}, "~S"); +Clazz.overrideMethod(c$, "getWordContents", +function(){ +var wasTranslating = J.i18n.GT.setDoTranslate(true); +var words = Clazz.newArray(-1, ["atomMenu", " ", "moreAtomMenu", " ", "bondMenu", " ", "optionsMenu", " ", "operator", "(no operator selected)", "xtalMenu", " ", "xtalModePersistMenu", "mode", "xtalSelPersistMenu", "select atom or position", "xtalSelOpPersistMenu", "select operator", "xtalOp!PersistMenu", "from list...", "xtalEditOptPersistMenu", "edit options", "xtalOptionsPersistMenu", "more options...", "xtalPackingPersistMenu", "packing", "mkshowSymopInfoCB", "show symmetry operator info", "mkaddHydrogensCB", "add hydrogens on new atoms", "mkclicktosetelementCB", "allow clicking to set atom element", "mkselop_byop", "from list", "mkselop_addOffset", "add/remove lattice offset", "mkselop_atom2", "to second atom", "mksel_atom", "select atom", "mksel_position", "select position", "mkmode_molecular", J.i18n.GT.$("disabled"), "mkmode_view", J.i18n.GT.$("View"), "mkmode_edit", J.i18n.GT.$("Edit"), "mksymmetry_none", J.i18n.GT.$("do not apply"), "mksymmetry_retainLocal", J.i18n.GT.$("retain local"), "mksymmetry_applyLocal", J.i18n.GT.$("apply local"), "mksymmetry_applyFull", J.i18n.GT.$("apply full"), "mkunitcell_extend", J.i18n.GT.$("this operator"), "mkunitcell_packed", J.i18n.GT.$("add translation"), "mkasymmetricUnit", J.i18n.GT.$("asymmetric unit"), "mkallAtoms", J.i18n.GT.$("all atoms"), "new", J.i18n.GT.$("new"), "undo", J.i18n.GT.$("undo (CTRL-Z)"), "redo", J.i18n.GT.$("redo (CTRL-Y)"), "center", J.i18n.GT.$("center"), "ekey", J.i18n.GT.$("element key"), "addh", J.i18n.GT.$("add hydrogens"), "minimize", J.i18n.GT.$("minimize"), "hmin", J.i18n.GT.$("fix hydrogens and minimize"), "clearQPersist", J.i18n.GT.$("clear"), "SIGNEDsaveFile", J.i18n.GT.$("save file"), "SIGNEDsaveState", J.i18n.GT.$("save state"), "invertStereoP!RD", J.modelkit.ModelKit.getText("invStereo"), "assignAtom_XP!RD", J.modelkit.ModelKit.getText("delAtom"), "assignAtom_XxP!RD", J.modelkit.ModelKit.getText("dragBond"), "dragAtomP!RD", J.modelkit.ModelKit.getText("dragAtom"), "dragMinimizeP!RD", J.modelkit.ModelKit.getText("dragMinimize"), "dragMoleculeP!RD", J.modelkit.ModelKit.getText("dragMolecule"), "dragMinimizeMoleculeP!RD", J.modelkit.ModelKit.getText("dragMMol"), "assignAtom_CP!RD", "C", "assignAtom_HP!RD", "H", "assignAtom_NP!RD", "N", "assignAtom_OP!RD", "O", "assignAtom_FP!RD", "F", "assignAtom_ClP!RD", "Cl", "assignAtom_BrP!RD", "Br", "_??P!RD", "??", "assignAtom_plP!RD", J.modelkit.ModelKit.getText("incCharge"), "assignAtom_miP!RD", J.modelkit.ModelKit.getText("decCharge"), "assignBond_0P!RD", J.modelkit.ModelKit.getText("bondTo0"), "assignBond_1P!RD", J.modelkit.ModelKit.getText("bondTo1"), "assignBond_2P!RD", J.modelkit.ModelKit.getText("bondTo2"), "assignBond_3P!RD", J.modelkit.ModelKit.getText("bondTo3"), "assignBond_pP!RD", J.modelkit.ModelKit.getText("incBond"), "assignBond_mP!RD", J.modelkit.ModelKit.getText("decBond"), "rotateBondP!RD", J.modelkit.ModelKit.getText("rotBond"), "exit!Persist", J.i18n.GT.$("exit modelkit mode")]); +J.i18n.GT.setDoTranslate(wasTranslating); +return words; +}); +Clazz.overrideMethod(c$, "getMenuAsText", +function(title){ +return this.getStuctureAsText(title, J.modelkit.ModelKitPopupResourceBundle.menuContents, J.modelkit.ModelKitPopupResourceBundle.structureContents); +}, "~S"); +c$.menuContents = Clazz.newArray(-1, [ Clazz.newArray(-1, ["modelkitMenu", "atomMenu bondMenu xtalMenu optionsMenu"]), Clazz.newArray(-1, ["optionsMenu", "new ekey center addh minimize hmin - undo redo - SIGNEDsaveFile SIGNEDsaveState exit!Persist"]), Clazz.newArray(-1, ["atomMenu", "assignAtom_XxP!RD dragAtomP!RD dragMinimizeP!RD dragMoleculeP!RD dragMinimizeMoleculeP!RD invertStereoP!RD - assignAtom_XP!RD assignAtom_CP!RD assignAtom_HP!RD assignAtom_NP!RD assignAtom_OP!RD assignAtom_FP!RD assignAtom_ClP!RD assignAtom_BrP!RD _??P!RD _??P!RD _??P!RD moreAtomMenu assignAtom_plP!RD assignAtom_miP!RD"]), Clazz.newArray(-1, ["moreAtomMenu", "clearQPersist , _??P!RD _??P!RD _??P!RD _??P!RD _??P!RD _??P!RD "]), Clazz.newArray(-1, ["bondMenu", "assignBond_0P!RD assignBond_1P!RD assignBond_2P!RD assignBond_3P!RD assignBond_pP!RD assignBond_mP!RD rotateBondP!RD"]), Clazz.newArray(-1, ["xtalMenu", "xtalSelOpPersistMenu operator "]), Clazz.newArray(-1, ["xtalModePersistMenu", "mkmode_molecular mkmode_view mkmode_edit"]), Clazz.newArray(-1, ["xtalSelPersistMenu", "mksel_atom mksel_position"]), Clazz.newArray(-1, ["xtalSelOpPersistMenu", "xtalOp!PersistMenu "]), Clazz.newArray(-1, ["xtalEditOptPersistMenu", "mksymmetry_none mksymmetry_retainLocal mksymmetry_applyLocal mksymmetry_applyFull"]), Clazz.newArray(-1, ["xtalPackingPersistMenu", "mkunitcell_packed mkunitcell_extend"]), Clazz.newArray(-1, ["xtalOptionsPersistMenu", "mkshowSymopInfoCB mkclicktosetelementCB mkaddHydrogensCB"])]); +c$.structureContents = Clazz.newArray(-1, [ Clazz.newArray(-1, ["new", "zap"]), Clazz.newArray(-1, ["ekey", "set elementkey= @{!elementkey}"]), Clazz.newArray(-1, ["center", "zoomto 0 {visible} 0/1.5"]), Clazz.newArray(-1, ["addh", "calculate hydrogens {model=_lastframe}"]), Clazz.newArray(-1, ["minimize", "minimize"]), Clazz.newArray(-1, ["hmin", "delete hydrogens and model=_lastframe; minimize addhydrogens"]), Clazz.newArray(-1, ["SIGNEDsaveFile", "select visible;write COORD '?jmol.mol'"]), Clazz.newArray(-1, ["SIGNEDsaveState", "write '?jmol.jpg'"]), Clazz.newArray(-1, ["clearQ", "clearQ"]), Clazz.newArray(-1, ["undo", "!undoMove"]), Clazz.newArray(-1, ["redo", "!redoMove"]), Clazz.newArray(-1, ["operator", ""]), Clazz.newArray(-1, ["exit!Persist", "set modelkitMode false"])]); +}); +;//5.0.1-v2 Fri Jun 07 15:32:46 BST 2024 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/modelkit/images/atoms.png b/config/plugins/visualizations/jmol/static/j2s/J/modelkit/images/atoms.png new file mode 100755 index 0000000000000000000000000000000000000000..12bb8e0b80b351a494451fbc4ad4bc61aeb1e208 GIT binary patch literal 1408 zcmeHG`%BXS5I_5#wtSE>F)cGe6KgalQrHY+>QK?GxlJm6FsJF#EH!67kTj8++VWA& zS(eWCV_UXDK|xboW6H#!(3GJ)W;01l@R2C?wf`dO;6C@@;NbJQE8}s)9c&NV0)Rtg zL>Qlp&U;QFNbJAxBbW?U+5GSj&`h{5k_C!c92UUKO1o{5HCcNmMesQQ1wH`9r2t!G ztJngN!vOf60KilL9LlWkk2wcG054j|CI gXzAUz7+kQY5*eo5{cvrQVRxxon~5tpIw!na*#Y z_hv>S!&pLJLDFWWHG{`y_@ABNDC|<4N26<1D(_sk1M#<|j4%fClu;kSiW{XdUFnu3 zM{4W!M(>QeYL8 K4~>CAlDql9kN}wf<6*7;2>Q?<{0x zYqczE(@04@C)8_%IQsFDtJ8x%;@6lVzN+k?A^hs6a8ceqcqQ`?4^xj&_bxY*%?;Cp HB$WIHz;zvG literal 0 HcmV?d00001 diff --git a/config/plugins/visualizations/jmol/static/j2s/J/modelkit/images/bonds.png b/config/plugins/visualizations/jmol/static/j2s/J/modelkit/images/bonds.png new file mode 100755 index 0000000000000000000000000000000000000000..3053ba4d1d9b1fd5844d6e75a0a9e3dde17decfb GIT binary patch literal 1378 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc3?z4jzqJQajKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCijSl0AZa85pY67#JE_7#My5g&JNkFq9fFFuY1&V6d9Oz#v{QXIG#N0|PTd zfKP}kPyr*O3?rkgjEsz|tSkeA3Q!dTgB=5dy^M^WnwpxWrKP>SJtLzBBcmrHqYopa zFC(KLGjlWpL#&L9i>$1htZWc7a|#nvDl>B-GjkCWQ!x`$2@_K(3kwjH>FRnpIy$<# zy1Kc!1qKF&hK9z(#5g ~3$+|8ReZ{4~DboMA14FSqS;6jJJKQIe0lmz(& z{~y_aA^1DHDlkMPN?apKg7ec#$`gxH83GbB^GfvmTtgJfjP;DoRz80OQnSR<#W6%9 zcx}LOu_glnmc=)!of)~6l)lCN|G)j1h>wWnuJ$KyQ_8(eRHl3r|L`nm7Q1zX>zsRb zz0MB%98-#`{Ik5icCD<*;5fhL^4eDc3%+YU)zJxeILv0mSAFLUr+5_486){kuQiu{ z4tsBQJ85g0r}yI0*Ds16?MrmAJFMMUuXQnR_VFC0Yx=HL{VPAFGwiUQ+7Vp&(dATS i&L{I{&odsK-_H;d>lvz_^ Xrp*(7D42QlWGr9{*~xdd!P28fK>8-rB3`*riv~pohOZ?o` F|9LK+!hy_W;Ui?#3G#;WuyO2hvM1;;R1OuXrhoqJuXh70;+tVz s5r`0!0Jz~WXECEQ zp;E{UOYDLhgxw0m4 (m{pi <~SCsk4=B^FR{;o7hb7y?3p zQVNSnxKY><7$JxNlu}p>!fl1^hao}KLMg)XE_5$hDJ&xBqSc1qfFw|>l)@sCE}}Lf z20{V>r3i~C6yUnBZ5RfGfa3M!Ew1ZyR4&TQ?$|04=5WJePG?4CLZ*-y#$REXf5IF( z7A>8+N>!#TQ7Xd12Av$O4D|$6K{-sRYcCe^bk=D()EB8{DVw{({>K7~gcV_7YinzB zb8~fdb!BB`etv#>dfGJ2;o;$AG8vD@qtR$zUtc5=>F(|hg+gs@ZGk|bv9YnPuCBVe zn!ocSBcqz8?L2mR$L)ld-sIKsUlnCQ8BTk<-jDF%V%0eIRW-=ZuFZ)&-fo9emG|!) zQom%&w5#U_zqxix^O+-B;@DcvGqwS8ObYK@`K2j0?NibY?qw^TsRnElvswiDp6v`P^o}pPzWkhfdDd<$c~C1ffN{$ z@AQ4ly>~~#1#3&1?Q^>OboV*m`OcYRGt(QE^u4>Ur>AGhrj1iu@$Z%N=ki|s-Fxo- zTk+3wZ{1GsX45v 9)mYb(8l%vox3+87z#<7INc-(ea_u zk_|hTLHSZ|>vXy2|LDKs&a3BPV{y~e i=$e+ij;#|MFLFJovRw{6Xb@_5R#5 z_&IT+chluPCmw(Okpn{f-GiT6y62j2jyXT*`QGL1>d#))`zK3IKmNw!XC8j ^|* zL+?EI$BRb)@c1{*ocZcgPc6Rw=+p20i_*yHv#-6jcf4sDO=&tc2bG;w#>HW%C zwtDS7)5fFE*0;X!#<@>0_e)FP^Szf}5SP6^{gwAT@$A itTy8vZcG Kj_ttC97*G6q z$4AazvwQX1-*wNql^=ilr+@wLubh79M?dVHz2oq!H{LdI*SlWq`RSG&fA-HuPrhy* zKKZNT$5$UcI(@)B?iKcqKFcc)UH0Ou%YM=`Vc1U!wS4D>#@l9AZycK0xM7?1>Zez% zdUDGL{^_NY_dYhi@`f9(dvwcJpD+H^iGP^r{qj>cuK2;vo_+sKd)YUZEoX~o@44oa zH~qKS{Q13x(Nq?nJNubex8L{fkAD8rzx?2n=AQiG(|4Xfb!68!pS 8rkQ?C0mdf9J2? zEcN{I`!64T@%Qh25l+>!Y2EbH@in&{?aL0xA13{Fomt_U#x+(}UET2*iCEvYzEF6I z$Jrcr1$pg-TzpkuU$tSW(zEvo?(NVm&2E-y?)C3uhp?FA@+x;-uI @0bdg_c8@9_P zSpV*p4BXt_{!mu9h-~NrvWBI5DmRP^h;d-1m=&E{-VAqD{KJN&jU>?YYPBJFC>R@- z$AUmOTx}SN%RINi(}SUUp|C(=H@VA(ac#Jr*fQ%{j&0G_qoD*Am+OkATQycy3=!?o z8K04B<)gI@l0NrGhgS8?r(SivZt%{V2Ky_9VK+k;@;yi-_fs5)TiP^lCQgb`gL^Zs z-D 4SFu#ia+%l@@v71=yv>T|=@1>tWpa?qKl9;iEzq$Q4cFk|2|7l{WI+fmkd^Vs zs@HJ&ln_qB^kDM#sU2(*M+^6>+HfQqpeyLy=e5$Md|Re;m#d!b;{Md}?CnTggBqX9 zR_uz$g(t66svBgp?V5_m`s<$Oi1BQ;il-DAR~40v?bfmgR*TfKE7ot?ye{KtmE`oz zdQGu@(;|jc66wWMz1mq!n6&XW*GL Ge#_p3ACrZtALHWbu~%<@x4G z<5%N?aH0vJRae%yH>6Ea7 9{&_n>Db2Su=kXcsxI!E1`z4t-%kIKL(F z#z{@nB|Imfz@K}wGN-J^^LrgXBYRBUBIldZ0m4DZgx(2}Zt4dmm09cR2nWgz6g0Vf zH=VM_9l=;W7aht(!0A8$+F^}i;lEUz!v|sW# =r-+@R;ACv`8!fvG|FpxZWfn1xHq+_@$6x*#Qcs zfoy*!+wv46<5;!Z?>Nv 6pd>;z7Lsu^bvWy)X839dX{@;W7Om3ddOs;+Zx+$d4 zG~UiAt^y$BZUS^A>IbNyST%ziN`)J&f5rC6&D++o72Bpa&6cH8#WhvRh=P2Tvwp&g z1sYoL&TnZs%~e2rUArj|poFF}-^DkS%iuL&n7P7Tu$vUO+6N(4x(IzF?oUARLN#1J z?!E)YiTxoIKB4i^I4%Tg5}$cXNA-{}gwc>`y~{c0v?lAP;FRXc97Y+D2c*h3K}0SS zDVX*gN}TL`2GT>e|Gd1cyg@;AKe#M4pU0)7J2mHX^gLv&^YZx11`1oa)&GGwDrX z2ceOOB{c;{BGshj7_1_alNPlwF{DUgz$h4$7DfbyM(k>pE&w 5tCX)-um zVka7RWtvACF?4u;_cZTyP4g;3(zdONA~@G-usN}IC^c+#e?UQl*CvbO((V(hz{qyj zB@G4a+U-8e#ctf|E)y4CQb;^a+Fw_6OU2m)&=OET$CJiriU*+sNP+XS{= =&nKIu2yssch6C)n_xS~w|X7a*-_Tb|Gla+V*C z9S4FsqBZ4=bV~p~;_x1?2YE_CaoA2qJI<*)!qznfbSt@KOhiz6AtA+A;;lRLQ0!>B ze}@!RQLsfC6#z=&0wM`6NCh#WDlB@rxbQ-I0&!D`m0R4cwFv ~-#%;6( `s$!fWc5jGg48`@%VpY$6kmt>ftucUnhHjVrZ{#zLYe z{Z|83XotC)P))b0cI5I@iTiv=7j_Uj`*|v=IwE8lhr3=I_iTH0dZKukT}023MQ1VG z?DmH6^lIDW3ibp$K>#L?MI?(7B>`9**ker7p9@c?q+z7y$5xj4J{g@R7xfgbU`QzB zpl#&eI{I`;d%%6k{X)8g`;1EZI4uVC2x##ISut87c&~cm;^IpP@XGWfC*(2<#7Q+A zM{nT ELqJ6|R5G?$w3#*{*G8yO6sOJ_uyi_br5j5RX*? fF z0i{5t&IENZfXAH!f V7rxb3Iai)&K{}; z1RKjo-8f%XLE)b!5 _h<40-dmxju9}UL}Zg%SU70hQ}i@;3m|r-EgdyEQH~=} zWyzk5CPCGFC<1Av+1;vnC0)&v&&ZCE<-v6-DcFxof Geuo>8 z9W{o*I9!f=1+oM98jPVDh&Z}!G9n0ckRp8NVNuddYWTki7F*hFfI-WyW?*YB6ESJx z`5rP$&8r8To)tR*Dy1TP+SJw3%n-sO&xW<2d4^M05Go8zA6HPL9`n(x}l_0cEy zF#$!GVg&uA#G-*Orc+orjC6@hP4T-x7!<(C9eo*0)nhDePOr%54N_&S3~Va8Oev@a zJUd}n6U|r&6|#0mG$!{ssBs5$GQzimwrvJgX2P*)9N!7ll10lwiUUTi>;*ldTZr)_ z`a?b*u #73)~0aGs$d)c0tF9{OMr#p-4Iz%SYvryszj>7Ob(!QsLYk z5Q)v5l8&En@;O~J6k{vp(Kwk?k!W4T*B|oNs!->=Vz(F?=Afs79U3g)i<>cYW{Yfa zI8z)Q8!F~U*9{hF_jz_`I8(}xvf)f&q&SSVhjSyt^XytSM;wFW3&H$oDKlCsjz}=1 zmL8JvA>epntW+u$Ss{}zjE$B`WB63e6^iofA4aV@ggbFod^yB&EYGkPcsG6z|6FVl z7&4X{&5aC=`qMF)R>?7(GF(71S_MrT+okUjB~xep0ftNN5m-SR9%6L7!7&_lu$YG> znUN9<8XL|G6~YBCdaSo(ku-^bhboK|ei0z~4+wjtA|+2y$DP19*=eO;cCn$@Z@0!p z>(NCdq0|Lci00w*u22!5qe=KobBL9u`{ZRAa=_fA3y07aff^-vs-mZD&!5uC6bqJ& zzPe_plF?41bQFDq8We7^z+x=*wKv@f4XsBdA fALOo*AXhniM?11_ zUQXr^pB8c~pBFbbI~yy*e{U@8yliZD3^rb$%GCcUt2 fOB}Bh@8k}`_c@oWMTuzZT&2jm+P?EFbQzyl*DKI6Ok$n+^H};C` z!EXZNUk;|vzd{-8OZrz1H0`a|RZhHij=V e9Kf&`!OLR^gz`UnTs}Q| zO=;2d)m2v8$gbP8-Os6)R|{#ZyOmFtc3t{x+~$r=QvFNhjIRtb15nBU^is(-*`GO+ z{+A$I9*W@^jnbA(8yZ0!TGohayh_f0=2Ov@454z5{eKxL04Re}SeogdCI6=tB{*?P zqz?A8NfyrdFPgn;<$Jh_3;#*F<%FO|2xJySdgnwiKnN}siH027|4BYOLH_^h1iC{* z+PzA+)#vNjDYN7B%hlvP+}HxgbWPTq&Im!I?B@uvlWZQY$@Ba?ch3Eo&$Trg3XG;p z3dysgBOG#sT-A+N!V5VbDs%Xp+%^LDF%3anotMGc8(9a+-flxHsLCDtyZs{+BLpp; zHlLr)vpJ?L%=3L`Yaw>PdestzAy3d`u|1&;*X$yj|7QO=1IT|6v&QQov3z!CU;no` z8F`(}?`W{MC*F2H`6GJhK0~-f>w5U`(b3TFrJwM7XUyIZjV&4Ve-2Y9|I>;pszwar zF0#{n8M|e7XCC%8pZV=4FGUPuJLvv91D6)V+rV+SRmW-v4!A5l6GYn9f+br;`ICL4 zlP7GozxOdl-44-YVdk#Q`}Hv-$x-u>cf{}ij(tsD#m%a3oY+OWy^fYptfLk9=ybgF zm0_@>^CoM5c(k^rYS_>I8MG0mrxMc}KW5ATZD-GfUsqtnvZNzawpm!)arpB>HT^@+ zdL;cZj%Hqy=)(HutLc9MGEkD+^_=Wy8|5)Ew$$u7SFq13EjL80&v_9$zq_f!uR6w` zLg-kXadmKlP+724tFcSIxc&D#T-wj&E>8|; %V#f@5JqSW#oOc?B)a+;jNu zj%%5l0v^wcYTKIjX#QV!&uf3WeBUlEo-^PXDusW|Uf(BeW7+<`yEyPoon=<^iHlWK z-!wHfC0X_MGU>ybet1~ {J1#)fU~v*iwfj0rI_qMg z*=*gHJ9)f%(c$rP;OHiiG^sKu{l5gM{eAFmTiPWcd^%mHx0iSn62rIu`%9^kBco@4 ze2=twSf%ii&Q(vUHK`qg(LcJmg_1HXQ|Q)?36mwZuh;YYf8bKnCs#Vi2-7r|&(N6_ zNfGNc6^>Es4`R723hJF-nwatVIdHVn-(t)F{l7lbv;5I!qpRsl4W 05#6klyO+ubD|APr)CYMh^2cx7>L`51}y zx~$BLk?Jcp=d;yj67nRv^1No;F+On0*0#NYP38+&II}zD9w)q+`@Lb0 4-{d%impNUvLt!X(LO*U5wY?Bl6^LjaKlLHB@Yrj2@&3YkJ z37MYLhHqgsp_$`_U!gSPHj!_5^8w GGUvx?q8BvVafg%bUV#BN}N?XByvvcd~ z+OU5Kvm1+)-c>Uyciwvo8ra;-{qI_&VL1ObkfGjoU~y*1M{s-o)GEtUwXtf_@Pc>h z7(xC6M(o{dYMj}9>dE&prt2aHrfbOvQuhjp|2ioryb3X=v2jbE4^x}#pezDCfeP*| zH>}?hozyXW+xxbY{pV0Rr{%Y}odkU}ZJzqSxqf>&+$f8S^VCyW|2wemH6~UqP`=V) zmE?!B?3>NX>iX^U&*gbcJ()}?@C>{#1AQ!)cb*1xjZWF^#BrdB{HrO9q~Qu-1oP{U zjP hrM?PqR3Gm-{|H=Vn9#(_yMu zNT%$DNFCQBPq_PusT15h2S6rr_&vLW7iLhvRwQl=#Y}DpBgWxlUj8 $lR zAG5Nwlqka;){;pUC(=^gI|NedAAp_I^Pel59{v{qBW!P&EhNxnhgVoIoTonCxuq6O zJ2cUu@7{nT{X(pFvlj6%w)R2{S8j#1Ub@0xSty+YnK@Vb{BK+07{S0vjo0mg&=OvO zjJCFRUzc>m!juu-?aU|{Y;buupgWk~kO!Bai%bBcv~!I+BDVhZFiLw`F8FkIoqa1U z{T_kO){=ESjI{L$SSe3e*^HIc2uw4Oks^QsCJNeRvBsQnoZc{))Zy&iiJ4&+3y;O; zoNd^L3;hEbEOdt(MvOS7R|eVGlDT(BVdMGvDScsj@o8H@G=Br^Ce5=)W*s*mHTBy5 zWRMeby9M!@P6svyFcDflPC$ZyP3OaskcC9!uRl-M?+KlG#^6?w7*YIZzr7G497BO3 zfrMlo9BJJim14n!9D~y)bvG|*O1|g`FyJV5U}w
0CHn4ELOjI85iIAzPG$4mk0*M`bVI*Tm@M6ofbi?>PQ^hiCuo zb6+mO;^mKo$$KGQhT{>NBS!Y;_wuTsE@;i&!B}-QHLKD}b#-;^`k_}-;nj_ow}Z;Q zDPale9K(;D)!Q-K0ExeNP}6bMY?mpJwze=;k>9#Ii(XM-5!6b`e^vDZEs^DnwJ*0B z>b3iL_yDomZE{ME^-r+sAP8Gi5(;@pZC5NdwTMo!onuHG2VfnK9g~u77B|>6@lS1} zH#7e70Az)!dkt4ep5I=CRzUO0=wm7HYjXJmul$9=f=JF>H+MG_Ljlsi9_9_K;eIxQ zx`KDU$<>8$t#O~UKDT5Kl2OmVTiP 6FRs;I h{Jf^2bIR%1Q{eO$z9An?Svi;~rZW8Irxopk*EDiO(PJuCs4%(mP*nTbp)z AyUiet*DZ~ ze=(9#<(K$;j5@c>5#@7%J6j$pcwqX7V-PdBsq2CQ_ }7^rf0Ve?Ut*zy2@?Kj|MOE z?+> ~I3%2t1UTz4hh*XW&d`!V} zgOdD4bXd_~STH;oPb+ekIAI_5D25}+X^_Pilq&8OMfH`+H+eXGCt+&akZ`_jJ+e9u z8mm*l)>zATCO0~U6TzDoBmI8m2J>!DBj+L))|y98Cf^YX{J@N_ILIJy;fhXA8Y0CL z!ng)vk%0u{%S{5o`vMoYlO%ec4^GEgj&^S+6N-k!t4 uV3HfA`BMLyg_RM<$p3=nLXwY1-LLo6app=M@uk1=g%Cf xv^@DIe{?fMAf1RwzIce*u;z($kh8?xrr@Q8cc`Nt#BRPh|`W_G6P}z3`@UiW^ z#1 eIR;-n^Hbyn&ENTgE!ZZTtQ a0yLoQ|a)$)z}SbPnaegk 3_(-i4F%zG1V%qtcpSH zEwj&fj%DMPj54G9p_@OI$o>A>Mb8aw;55MT4Z^mKcYPvue~?Sw4E@+40dQkxj9^02 z*?Q*a=vFOda$!H%p*pHeKla;?F)`o|fx(tlR04eb3b${gmdVWBocf&4 #`V?oDJphxY5i&G!qBF86>q!3WULPhwF} zsZx%}Qc;``;@pxED&bqB&3qK6l_||?a%qg`5Ennc>rpp8Pqz5et~vkX;vW~wpF8`z zal(^9$$N3)u3}AY@XWkfN(?By(lbeEcH&Y7!QaT$F2!WAEvlNAreMcmf_J_WUa30W zEvTjGK#yMaE*kh$Esd@ur6wj#3HeW5z #0#ru6;XydZ@3d8H_Ei4IO4MTZu3aOXXOmnpfMR)ei+KREv{^ z30y3N5Gb`ctcXyTs(_%2TuLn6=wt#?4SLsb`QEk{3=N1V Ah!t(b@ zvK+)pyqw<79RrY5s@pF3B4uTXd)w$kDxqDjkWNHJ>;nZL?+PMFpps3fY!SOfjep)y zltt1t)dApmqZ&PQ+@0a!P8x`c0oV(?jhGU0MmJR|`Cnh%H#*3mjYQGbwrTKh&w2?s z&Xy_G^(9i&Mm;BiF5UcP<`kz_QU3&*NKCJU %kcdP5w(_)3bloD4f z6LPYkPJ8=?lp!8}TT@ea&OPNaSkO1LE?94ZUp`c>9gU$J%#GWSOnOEYPM#xtUhUvB z0r=oy`e}|zJ{81-9ctv_UrXiUw9s(I6e3^3hGij>0T1;NjUotqVOqvm?I(;WLEqy9 zZs5To4qJBP`AkpXBk _Jz75=K~pPH35! t)nU_sNf@rdd_dWOXRzcIVTSb$}6Z&1Fe_@4MBAy@ZiS z(#-}Vvi5s%UYF6 }Vlq-t2KQ*IS@yS5Yw_=eN7$|JmGZ?Q%3+OgtD zdl6u*D>aiHP}XYE0$~Nj85IA)RB=R2CmJU#_|dUrvk^+dc2mHQDOw6!-6wxAlz`@F z@hyh=M`Io+?L>@YFJ@tf<;YFq##*Jhyt#xNWm^jwj9CNP?>MMqEaLX)UmGXn5y1!J z*>IypFc)3_{Ks9uw1j%pyv)z`5I@_)Hj_BRyhgZSJaG#Uxo4{0ltjb}FtdosZZLA| z!qe@*(rb6f?)aBP6hpMH&wdz~ ^I6AH^4>w$}`AR5YkvZC8>54Tj8;6<3X0w4tgSeVU$LDc5o*PJ;F% zU9Pa7g*gR5I6jBI5^x#PP|(LOypWAx$1-6+6~gZT#9cNjasj$G#3N8cpk25KXtT)w zsKr~glPY|>jvw>d-#_Qub#9dhb#$3$D#C<6Mjg9k3l2YP563Csl7FU9x0r$bSJG6Z zUY!)~K<%>>*JPGQ>%Kf{U1)rZ$iCKpKeNpK%;s)aT6W#4y $`xAF8^oda^l?66Q)QUEnW|P8wR7`ayh?Tdt!asc^s8BOW zSYh~4)3zxA0rKMj%Qeh^cFeFw4^^Dm9E>v*74UlU(7S%x&}g={QDi@eAJ4|rMLGTl zr1N$$o6MhUZg31#>d6#UH$`4d?7(+*{~n>wy225%c3y0n5!##eO~Z?T3rG8*b3Vzw zlX)zHvz6us(I=j)vX)sWVZQ!;y;<+DXA%1Q6N&IjK{y*N)-$g;80qI37Jg6Rm$Dd- zDz9jhZKj#Le{Y8(@xt)Kq(nXRxM*H Q+_wMEjkDrOMwP7Ay91qd! z{9Pqg+IB*q15_0Cj>#B>=P?plwpTQ_=kPTla%d=!YC!{_JMOC-{g8Od`G@~-Pjr=~ zIosArvtjCG?%rO$Cc6S1Wu2i!^AXSjp2rO90Nne_Uy5iI8?qn}-A~_U%AI@V|Fp3n zRPy<>@_k&p9|Q&xOGtKTX3EQy*5UO5TOTMJA<$UF1R vu(8ME zcK}0P58fX2?Y{Jm5}iA&c!y?*;Xh&FO#F*^j3V=q+Ox|QN}lsW#2;9n1WvQpwc^A! zocUqGxf9G+oDVy2F_j(&myKODYJK>MmJ4pf2pqwiB^C!Ko0Sa@bKPBU?PEW*9An>3 zm#}S+L;cpueScx2&+moGp3G-Hu=mNkxaMfbi+~F*Qc`mnSlDi3y~5!fkCTC_n9MD7 zf81;`A7n{JDL TN>OV%xavr z6LHNLd+hG7$aD;g}C+*rT$(vv1Ts-_C&}tph`0+GOzuGNnDA8?_CAgtVk!IlSI*Wg& zX6qQ&a^M#l!Mh#vzH;SMGIb-=DpawT =`amj=?A-D~nGVNFY1-;r$EY=>TR zY@xwoYJw7|@ Vu4iZT**q_-$z gU4%cvt cb=@=_GNFIV^TguEQ{Gph#<+jmI3}FD(AzMcbq~N{ zSO(9{xXK0+@#S#p# X!)Jfa`*#(95zyV5^hZ22t+|x&-@*7V!y?r00zZs zGUl|+;#xv_EIc34m3e(QW@wloi0AE3V#0yLkdGt*@JOIie(WQM^sNWxZ>&^%w^>lQ zCUjc<<9nhCD2JpK6VINTEA|&Is(jRy(uzP*J0@47hw%f6Jd@q+3o9<2xdIpqHApXI z<8-6n;O_@%%dHltaGm_%y|y7s`u31hyo}NgFM=;k0Ba?06T#}V-a%!8(oRCqk6a0! zuqS6S^}AFPTw1&575Q@~`58;U;N@5Qx*tF#rE%Q6-mvT?o@b6A9cIOl@QAcHPKybW zp1mnEDJk9k&Lv~te?PypBu)5Dv!g!x+yv=XzgkadCHQiy+H7GUe{UHMlAJX8g((m$ zhZe;Zmm&4a-Q{M@M1CCA(O{-_HTDc%$HQeSS_O_SX~)}6Bu5D_)=Rtf^?uHNgiLoL zQ>3# JEq=;6Ry{Ze=Exth2V}c4~uw7@bTM|fK#2WBxc;;fGQL;fS=R4Wv z!xjeh4FQ!rnmv{LRmwmS{6V2l0*u8n)`KlIkwF53h4D!*kV3NFyJ_NLp1{YcTRq@x zc6&p&S{dq8jGN{9!O(`{v=BzKG~%)!H5P(ZhH*l)yc@|W5J}IU>Id<3w=U(m8J`-O zh4}5bc)t;@_a++)HvaLA+I4*6ENqIB1=)AU_-~0bVf|{MhPnS-F$;h65jH;_6q4_| zC{(iE 4Yq8NME*q1F& zT)Wz(@k{xkKs-2j`2>e+MM>*Zq;WAyf~2RC4DIz26u)xaEaA7QfM 1Xb>kEw=M+yv?ja-bMUy$Noy5#!<;~h^YI46V^VIic z+;{okO|i4L?UY+W!NcC6r%HB1jzjtS;8>*B6QwOvM0 ^- ttLSDdqBg(FQ;GAUWrWj7dkb5VTYMK&LPAq?VI-~( zDAV?({HwOdXDeXnaN>o8=;zgmUkZWLF<1s)Vwn|P9+_gP5GVEZB6nNrd1;u0=t_@l zoKKA}H4Zv6CM-8+9bk!rh*ZIH)S;B>xW$Ra42iDKUp1kMO-*jxCJN{a*OY!;RFob@ zQ~d!B=3nxo&L>K=1COObxhSzC)IXOZ(I+aP>oNKNnHh+hPd+5vASRbfni;@ej+mIT zpV_k@L}~b@{t2xS&nGG5D&$E ^C;(tqrsZ=+>l3N zEnJv*E{VLNF%`?F-bhaf5hj9-1&6+^umCwWIY(6~r2K8nYtYQ1Z1)%aRAjsG?-8kS zq6meg2x*p2EZ z?(kXJE%@S(MEfOnN9YWGIN;Y$C8D(`$^ulBQ6spFD$9jUj@z4VYFKQBky7@YWR@wm z)|RxtU*%%E$%)3qd;@z?AW|i Y8 zo#3?wD?F@)BC#CQ4o$d+wbvT}llk_RtpwoXEoFgAL2k6*9R8uenue2<6-=@fW&))P zil%PMo){*G;FAcEZa<~CoVDv#3^KPg6r2y|NK?9)0%xTpy_yp4^hW#&Op$MrEzn )wEy5=(dQ>EUI1M%y`W;Xtn44}a?5<8Vfh?@Nce38R+52J z_Fq&@5PalITY*N9
NBJEm@kQy88fa(ZRdZ| zEMmmh^f>SeYe{7iydh=x>zMB>!$nn!iO$Iq$>Y%g76lBfFGp&D+NouO#S4kowv(Q~ zeqzbIe+R8oS)8ve+V$#+neE%@jf_}2B#5!EACEuNQsy^zQ$Us_tWVP7c5 {9>Z0Tb#+oatggiRCq%=vN30Sap9lW>&b2KBM<05rWOR^j` z3{-20IoqHQxFe(An_HEZO_!#iPv>NBBOEvJB{g7FJFR6|L)|de+SxYIo~qRIf?iPM z6yue_pF@sJdhMZ`h#19B-ifM~okaL(ns6G|NkyuBo^*fKMT*sAN~3H4@I49qw_drd zHIeDJT$z!6Z;(Xo7%m1UUcgu|{a3}xS57Wbd#y73Yi0S?$XNC+sqVE+OzrbpdAFJa z*}ul3#M +0yn5?~xd1dceu05Ra?bXZv z?Nifbhl`zF*UwM%fwK7JE~eVE5uO3Ni3}I~RX9|4d;}(4j>hyNfxA$+pmdC;T?AjO zRS!O_2PNP+`;6o_FHnW=^+|$Fp<7W(qOhLcPJE6EKQ%}AH2N*bklPj(3|e}!t+z1b zuyrrduJ_29T)F&QGPL$*%tM4}c%CBJU=M1E^anzJ)-O>6jbdLt37isqR=9&!ij7e_ zic_?HLi42QGvLA % lyd(MAj=ir60E8a@_2+lSB4Ve||C_S5g1EhZ-UEJnBl4qS1Xw(I26wFR0R zeQ!=*odP90yYt g_JxtW{rZV7eaO&^|q QbHQ4phP=_|#& z@3?S^t8)0zW|8l `$mZ6P+*l(ZpB_dC)nxz2->eD$taM% zR|muFtKh4et_~8V+BZ^~nttFha5?-4=zA4G|E`^uIk{tP2evT64jUND?~aNNjD+m{ zm^>!oEI08YL(L$Q(IQr&a&Fopu#5)~`}S)XqZU@#eR$C1DCqtvHnA~RaWmRTdp-P^ zXC1SM3NYsym~#Z77dOt91a(t3d>4=_x%f*DG9*VZfT!RLlYILI>j3n=K4R#f4gCZ# z(IrmwE|tyhZNw2pcGx>~dF;ox(AP;wXPX6iOdkkJ;DJQOdlUh+*YN)48BZon@Z*BX zShh_;SZF|*fXqa^l&9gyRFTTq)5kB{_hvC8M;nNXLVVFE{fx5_XhZ={%U0?4#)lDT z>RUfxjAYG51m2Vnr(Rs@E%G>Q!-bJ7M)JZYNA1_1Fs>~*iH!G?vP6R }K{8yieEl2!v0>ZR(1~gL@vlq86V63Q8P||Te`dlWfi3DhJK6%8 zB4(b8sm!jeU8bw4xr4rSeidyF9|P;nZ?7HA?>C*Rj-FT5hOBBYLHv$qtH=JXn5<}c z-pEQoBcG@GFYdfz%fT6RN{U3o61S;5uCABvkvuoL39PVmLqpq3JGLw XK zye!)exTQuodt#Q?7_0HkA8I3&UsGyP(t=SpXvj>iSbWw`(Q~X$7?Al6xI5P$g^n>L zSqbIws(Jfzd{vzUVLdYAmiSD0E-2xHGr=)^OChU>#|P|}^JBB~(6qBPCLbQdjRDo7 zC*1<-x>igP?59+&)gA^mO6o|y9^^M03S$IDk-a9rQ2Z&{Ek-j%#%UaYJE)rIg!_T! z2y@a~gC;LsKOq=WT?AQXpONqG`|v*lGH;r) MZm5j+-3qRULpHvd zm~|Vj{aw$_FK73+d(_L;>98$30O!&HQv^7%-sOtb5gKL3LYgX{D5*@k?!`0nUB JQb)J!MWunaC(*9$g2V9yox+gK2TCADh*eT=_Rs-kLZU4HA-yE z#&HfsOYGndPNWa5yG4ms#EmjG==T)fy^r8kIyGy_(bF{I AL6uNRAVU4lIVnFzCS !TjBYY4KhVvUAeiG(kCcr!$+SvZUF) zHup8c?K&&7m{~7jcUZKjq>f&3MlFTOZ*$w*Q@=;8l%Lu}^LAGnTK8&I=R_KN%jI6< zJayLh^B-HuRZ390#CIT1%Z4&nRSx%Y)=|KbS52yP67p>H=F$mJYYc_>*_QfyY+hmI zCcN!u6{dupLY?oYyZZq?r^WRVIO^%D{KE_iV$uxtaQILYBBVs180G$52X(tD@E4y^ zXz^4$v09mKa4saDIuJmIL=Ml+J}hCA)SHy@L?hh3f|^-zq AiC1#Pbe0|#Mi=q9gxZ7m@1f2;(2R!0aGOxcx>V X--3)4 zx+Byar_@0kUyr$9XXU!gr<;uwXRJW-lRseDz}I+ts@~QmWZ?eLXr8=HD<5s(a5I`{ zNmsEsD8NQn1ctz|j=pYTw@Pr}F%O3XW#S;i;V5~C{m$+^5euZPpNlz}r%rWK)5^nE z8lk7WH;76!7@ 7Bvh@=;@QzWJ#h&ImpXUFw$R^oMpIqteTmxAF^4u1&Z<|DV zMc3S(;NQXB`detE*?~bhNYiyj^62qN0cf(C34VEhzYLff({=1f5!BgqU$qzhxQ+|B zNy>ZMf)j3eIjN}mb3kBFcMz9jcdFkM@G_gH7XH5Z@8hx2(D69_()W nl+sqh%oll>7Iy%gFr5`6xh;7St(Ph#Q`z~AQye_ zxlpKAusfWEV5pE5gQ}?R)}lH5+;?YX%}(6TzoYf~2-j(Wla4b-pHX>*QhjQF_uPCo zVPTkFjNZxW#}oe$zNq7}UvWK|E7NatuhMBWd7l ~{UlQm^She~^MA4{Mo0|m zlDZx);+mJ1KSBQom2koA2z&RsiQFO5fVTu`k^;Qf<*lm-QvauiRmX_%Z=|&CpR@}Y zIW#&s#DtaS2;sLNlgj6iUswydgpTd#|IpdsMqFIyJp;u?1^2NeNwt9~w>d@Ny}`d= zQ6v+mgYD0GpS-No+humq(b1gO$8};^9Enar=F4> 6z=Oq6^ z{)PEv8Tuxl+#Ec-=46 kP0exB6M>7Akh~uR8ZT)ASr!?!L80ZC zR~g*>b?tE%>kG5Fzm@iA*lt&BYs^D9eV&RSP6J*_18yjPA-nvLBcNv%R42Bk8#(4Q z$~bRN7OIL1_e0OC|47%6=iQYyljT|%Z=}CmxX~SmkwzCD&c1-iYQ$ f~Sn%3Z+$mLVb=q!xCHhG|Vs^lJjS`lkb4n*&x^E&DH?_Z&z=z7kckShC@t9nF0O zr0xs3-`=7BL205_d#v3qlnugNVw>3CS;r3D_lAv5*;$7i!=SRIw;(cOnUNA|6Xlig zXGMrLA;^Yih-DJn!`8;Zs~AVyKhEF*+f|a{6L`CF9o*0q)15)-8S7*=h)1BD1>DU@ zqsKjN_%N3=@6oK%%2gG-5qqrl%npV> EOyPV>+bwiEbwXSQ9+FV80FOhNwnq(5a6}7Ym^r5{Bn-eG(hs(A+4@ zD58L!vRF;_Ilj%2B4w9QILAyfWr(ioFu*D*(Z0vfR~UhsAdh@4wl}nmDmAvZ;zv;u zs^uc_yY+7%ADI~hP6!-Yaxu9+zvH?3H8%6GmO`hz`t(U>>&Xmq3|7hSq zccyFzANsM-(er|g{D=SR>SiHR<9V6txo9ed F1{*45l7(wwN9ve-l;cB;1rkF5bVwkbqM0 zq%Xf=>di>RyE!XBUQIuDN)p6^4*nY#kFI$`lUUcIoZy>7QR189>}R99l4P>^vd}DG zBBv9T3q_?IY%sc8mPVohqq*^yUHiOs5?ga!4o}!AW(VUWi<*@uAh0%cTV=6H%Y56> z%kBJpt|o(JsOh1;Ko~NC6V96-2AFa;U6L3x)|1eWh98P5(&N;(Eb&Bpdp$D*=M5Y! zXgBFZ04#{QBPin#pP)(k^N(dW*5m0W2F(&dU0#K0` &0dB=d56as!;kMwiw-JN%fblI$qJo8&;SSfs?tir;kBd7COn@vCa z6(jNc3!PfBheobFE!od*Tprpi{gRg&|9b`lF-(IKR0lDlDC2d*&r(sj%v?bl|HIo^ zBFaPuS^{r~bdZ0wQc~eT1>)p7(f&(ORBgn2e6l)1(F(**U&Pmf&mGLD<8O(1*%^YU zLQiB*At}Btf$$6HDI%i$`$x&M>L@Dkr`Qp~Y8I0Us_lQgXM3ANz)6Wu^6Z3NPEi zd2DV>25+G}GM3NJ-Ub=bWc}n2U?>emL2Ov#amb$J!tn?N7Mh!(HIUh5k>S(;cQ 8WE*%%P#f6-1LXT(7MvU z{2fU~DBIQv@t}5!+1$T6kd?uAmc#ub1o#+6ZvIb9%8cRSqebpdZ5+8yv=!|`*H_IA z=h*N8UP6dPOVF=d)Mm)ir4LsN&ql@Rm7Y_Oqw<09U(5%^q&TQ?7)18s-UAZ>4?f@a z_Z7L<@3J=E!l8STHo{Z_QA2~cWMw|%LB^a$1=>EhYQmqAo_YDowRo6T#pX4f&>>&v zcXO+^(4TR>(iGRIJjdTdBg(Qh3dj;F9sUx*kkQ_jCPLi>$!-wx#9n4_l0?>>M4^8p zbdj#imd^}i7@N1R%*ssdIuX*^h`((=sKxvSxNWe&Tv_Azgf$g`BOMm?N)<9f+D(+K zk*tjP=6gAut81Jd$hs*!G-MBM&0-)yo@@2q4Il50{^-?weWbvqzC4y0IT$N>k{N;L zvRim3Z!MsyE}>cxeZGCpEPn``#QC)l)f@7LE??ZF9yGq25~u%n^;23}?Q?SH*dO7C zr;4&l)(V&UGn&ZrlceuQ(jsVj6znx!AKqv`Qpzv!e ~@pFEO zS_H}J+1Esf(a0 4@kiRoh#Eiq`z`D{A+$~U_&lHJVZ;_AmsP+ zuYJWLG{AS%J=+x^;dV3fG)7J4tJ=V*;+bBh)AU9|9?F25wb?A*3wzMwl|6S9eMhLc z;+iU*d(&`x{XLQyt>M+2OKFU3H6Tq%0$w;kHBkd1Ie-*8TUo!zLIRN}+%m9Zw3#63 zW`0?aV_bL7Av=_R8zbCx4`vw{TFo|US<0Cm4F|NgYay$KYVK9nViolpXzQ3|vE^>a z_SU5TuoV|2fCOaj+RiKqAzC@1RF;lRNjuM=uagE)G<751wJ&%Wqy99(Aw7hg^O4^S zO4|<8_`3@2xAf3W6aOOxDk;8HaKk@E%NPZB_X{wk?0tVo;g )afznLk>R4YK(Pm$8UsFZqj>)N*j^t{@8$u4ar>hT4rfkSw!jPs2T~Fv09g zalo{5kj1^7;NJ7l%7#b9R4I*irGc%8LQJ)>*6V-?P&tvJ0uc=p6(mn{HxSl89=K%n ziepatdE!ljJDR@VxTn}$4QU`W?C39%E}2zv<1k5 $#y=|Dab|QY9Qbq(mtEP>3}~U6hE4_&Wf8>p;0;&~fIwl*_QD$; z%acLX3>M+`IZpIJioKs?32mX{0RT+Mwb_h* 0Vj|CJ3X~LXV8}$u89}2*G;f6 zu&1&4^O4p3=f6X0ZMIZSv@pEw(}5CBgCq6-) w-u{r-D~ z!BYi_l+*YEO-<9_oVsOHSPd4Jr+K7lAU2J! }-;JiAH z@NVvEwp^tIo5&Uz<)uX0uTEi08DA{~hKD~dn5#U91^A!PGMOVr2uJi~vC#fiopFJy zKN?=`Aj>M#xEAaI0{PGQht0zctS?k=!V25vR1L (%)*l_LtbBxRzGNgkTwpR=>d^F zKJp>B=d={Cr;gPhxEaL*i@`o_vbP0agk6AaYUtZ*QqwB*lXdBG1kPLdyP-0c=BrP@ zmGUOw?uZg;s1CLe?dx~PRrJ-OR-_Q`x*en)f+zKJT~5d`)VZ=8+H{RqK9fmRHH=x^ zX0{sAPNy{mkW=+0TF9gw-vZu`c%+H@&r>5i!m0*P_&!eG64uJ=NaN#~q8m*109zrN zzneZmK=|Bl>j8-?&t=(VhZV$c<{p+y`B^EsxuO{CuHb2R-*bJPOxB}zt)-Ak$3GvX zwRS-xQ;0gysuIw1AAhQv&|lW@YXwK=0HZrCAxnq*6(Gg#LJ5iA(xuh5hSD{5`mzF$ z8y zXxr%J3%+kX-&D3{%TfXMN)(o#!k&geqACyN3Hu`UEeku``!rJ=!1E*ydoVvq3wW9~ zaqB|kiTL$oG!lklqa;7}S&f$T+Yc3*#sG(R0SwOMAD%@;`7DdrhG>gU9fw`mkRbGe z$@!B(xQ_S6ny+Gc-EiY#md16g>p1xLkrHsazbTKtPVE1}B#0^)8>FU8UuYjA!QMqv z*H{Wv;FKXz#n9i^2J$O0SXVrodXraLn0c5xSTf5SDjEK%CLw$~`>LSem@TG@06M=A z?5Za0&E+hZW+*_Lo$Vq<>>xz+TWUDY%j7hDuGdXR&wMV-z{&(LdXJDemRM0o`?GR3 zI?5p;eIkJFn9?3@W9)Qv%5X%BIMQrVkGi_AhfQ2@qWuqe`ld1bk?)JLUyQy}_-}j_ z(h$}7t#tHHS5w#daL`;m!d>b 8-&sJk2@O~CH0V(- (oUT(?nH>Djm9r{oHfCbZZ*&KJMuZZ zPlMd$1JCz!W}#=1Je0}BNdlwBHjj5_!<+Jz)AGd}b4HzZB1B^3u%BUKmpm4J)4xVC zEGC3Jx?g&${{5|7PII_!5_VHDeg9r>Vae3>_D-z`QVJKN5i8&(`rz5_RI&1){f2{R zj}oRCAy!;4{ib4NLCe9&$=R%0G%gkU!fA77QY7^}k@fngn-4t~J#Y0WvpMh5Fu?q+ zLAn}ATCsl&mATvc^pbyZJL4;KG-|Zx{>(dQzVj!}zGV+kC3v#eMjVYinq@!oZ?F(c zWD6Wlh}OvepzIyH>*~UP;n=p-q`{8a*lw&H+jbgjCuwZ8F&gX`jqS#6Y};(kzMubi z&N#2m80QnLxz@VooELt;T4hk~Umfh@RbAEOCX&U6)^-xn C; zfX*Z~|6G-8k*mpR#9_tWdAe&mC1Mu;fHCR0uR6%d? L~yvfpsWkVW_pe3@mk*>pJ>n798K>=-`fi_S;MwlRsR(QR% zNQs~Rjtq@7czR?g6Br-`i2~#}k~rIWn-*B@O_?~}!CF%(ht-z?bUU*DHsZc;)vpKO zA7}g@{Q=N`ow$V1BTt(8V8uz)^DGoBtEANED~4Lo7YVwot?ad+_4yDR) SqO2~o~nvXK_W$TIJ9%?X71B;eHbwg|`m(5CIq zAD1eL nQ zw4z3dQ|G8bRYtU(Sk|qQLk3hi=eVGH(BSV19{m31^V*Um9t5^C7rHdompGGn27A05 z6On~|`Z?`h3vaW9VHYFDf^fYRCn3;Vs)eSPJMZkd0cErTWhKik0L}Qlc=l`prGbV! zbwf--veN`$aAsjQj6=5m3%&oxF>bi_mz7s6Pc23;Z9NHR)twkKDyUgNJe;{NyT3F{ zm!b4=oy4u6)dcq^jLNT^JXF29_gp~mZH%M^vV#6OGRR9n&lGLvlRgCsi^oj`174{1 zNTr80T73uBZRy4EaS +_){Ny6(2#w|i1wzJS9r+|vK zho=WbP9f)(Grslj3G`fM*Li8Nusm3DCdzvBQNrQZd^&qE4<`zH-E bL22?=^WGJ5_VzcKNSWMuJ`GB4(F=6avC{8cRP2H81LqYPD(URnjmO2Q2+lGYnQ+KYB8sijA!%&`Z1iX(k>c zyFAW^hPg-U1I|xFuFQ4J$G3HivLvkX9Yyn~sOX!?rD~jot?QCT-KrnlM%bJSjHDiy z)QwU_juhaGZUT!oe?zTSL*q)k$&ZHLGc~OCMos@bM74sVhhJK%Y&Rb@*&8bphoHR@ zHurXqDdTTZ#DG=jD7$2jchnlUW547tH}Jragx@GUL_WY{>?u&Nly%HoaI z+1)pHW)yraN2{P9atnJN)|f&t0Nu`&WJSy-c;DLNT3n6`1(}s;(K5I}6j>qJU>MYI zVBm5>t{D**C`%ef(-aD)PZ@H|Pc1^QP3Sduz|Q64e<-GOgzdo#&D#hZ21gq~KqHYQ zX^Q+<69QiHbaEmIfe>0-2C|dfV|v&`7zR!P{wgf(X*&(zZ>k}x^-%coat#tbZHE47 z1#_$ KQ5RKLd`bCZNvKs8sP3Gfvh#_OuvF1v5_kkd@RCt_ z7!}dVNY+WU7Sda3XWN@-p~H40SZrhI!FW{B!<~|07r5Z ECkH