public void highlightAtom(int atomIndex, int pdbResNum, String chain,
String pdbfile)
{
- if (modelFileNames == null)
- {
- return;
- }
-
- // look up file model number for this pdbfile
- int mdlNum = 0;
- // may need to adjust for URLencoding here - we don't worry about that yet.
- while (mdlNum < modelFileNames.length
- && !pdbfile.equals(modelFileNames[mdlNum]))
- {
- mdlNum++;
- }
- if (mdlNum == modelFileNames.length)
+ String modelId = getModelIdForFile(pdbfile);
+ if (modelId.isEmpty())
{
return;
}
jmolHistory(false);
+ StringBuilder selection = new StringBuilder(32);
StringBuilder cmd = new StringBuilder(64);
- cmd.append("select ").append(String.valueOf(pdbResNum)); // +modelNum
-
- resetLastRes.append("select ").append(String.valueOf(pdbResNum)); // +modelNum
-
- cmd.append(":");
- resetLastRes.append(":");
+ selection.append("select ").append(String.valueOf(pdbResNum));
+ selection.append(":");
if (!chain.equals(" "))
{
- cmd.append(chain);
- resetLastRes.append(chain);
+ selection.append(chain);
}
- {
- cmd.append(" /").append(String.valueOf(mdlNum + 1));
- resetLastRes.append("/").append(String.valueOf(mdlNum + 1));
- }
- cmd.append(";wireframe 100;" + cmd.toString() + " and not hetero;");
+ selection.append(" /").append(modelId);
- resetLastRes.append(";wireframe 0;" + resetLastRes.toString()
- + " and not hetero; spacefill 0;");
+ cmd.append(selection).append(";wireframe 100;").append(selection)
+ .append(" and not hetero;").append("spacefill 200;select none");
- cmd.append("spacefill 200;select none");
+ resetLastRes.append(selection).append(";wireframe 0;").append(selection)
+ .append(" and not hetero; spacefill 0;");
jmolViewer.evalStringQuiet(cmd.toString());
jmolHistory(true);
-
}
private boolean debug = true;