public void updateViewerCoord() {
   for (Atom atm : modelList.get(viewer.getDisplayModelIndex()).getAtomHash().values()) {
     viewer.ms.setAtomCoord(
         (atm.getAtomSeqNum() - 1),
         atm.getCoordinates()[0],
         atm.getCoordinates()[1],
         atm.getCoordinates()[2]);
   }
   jmolPanel.getViewer().refresh(3, "minimization step ");
 }
 /** ***************** */
 public UpdateRegistry(JmolDisplay jmolPanel, ToolPanel toolPanel, List<Model> models) {
   this.jmolPanel = jmolPanel;
   this.viewer = jmolPanel.getViewer();
   this.modelList = models;
   this.toolPanel = toolPanel;
   this.mouseState = new MouseState();
   this.dragMode = -1;
   this.addMode = false;
   this.minimizeMode = false;
 }
  /** Create the main frame. */
  public View(EventListener listener, Map<String, Object> config) {
    super((String) config.get("name"));

    this.listener = listener;
    this.config = config;

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 900, 600);
    setLocationRelativeTo(null);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new BorderLayout(0, 0));
    setContentPane(contentPane);

    // add JMol Panel
    JmolDisplay jmolPanel = new JmolDisplay();
    jmolPanel.setBorder(new EmptyBorder(5, 0, 5, 0));
    contentPane.add(jmolPanel);

    // add mediator

    viewer = jmolPanel.getViewer();
    viewer.evalString("set debug OFF;");
    mediator = new UpdateRegistry(viewer);
    jmolPanel.setMediator(mediator);
    viewer.setPercentVdwAtom(20);
    viewer.evalString("");

    System.out.println((String) config.get("pdb"));
    viewer.reset(true);
    viewer.openStringInline((String) config.get("pdb"));
    //		viewer.evalString("load " + (String) config.get("dir") + "/" + (String) config.get("name") +
    // "/" + (String) config.get("name") + ".gro");
    viewer.evalString("wireframe only;wireframe reset;spacefill reset;");
    //		viewer.evalString("set mouseDragFactor 1.0");
    jmolPanel.setMediator(mediator);

    // add RHS Panel for user input
    JPanel inputPanel = new JPanel();
    inputPanel.setBorder(new EmptyBorder(0, 5, 0, 5));
    contentPane.add(inputPanel, BorderLayout.EAST);

    createSimulationPanel();

    inputPanel.setLayout(new BorderLayout(0, 1));
    inputPanel.add(simulationPanel, BorderLayout.NORTH);

    createForcesPanel();
    inputPanel.add(forcesPanel, BorderLayout.CENTER);

    controlPanel = new JPanel();
    controlPanel.setAlignmentX(LEFT_ALIGNMENT);
    inputPanel.add(controlPanel, BorderLayout.SOUTH);

    pauseButton = new JButton("Pause");
    pauseButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (listener.getStatus() > 0) {
              pauseButton.setText("Resume");
              partialEnableSimulationPanel();
              enableForcePanel();
              listener.onPause();
            } else {
              pauseButton.setText("Pause");
              saveParams();
              disableForcePanel();
              disableSimulationPanel();
              listener.onResume();
            }
          }
        });
    controlPanel.add(pauseButton);

    stopButton = new JButton("Stop");
    stopButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (stopButton.getText().equals("Stop")) {
              stopButton.setText("Start");
              pauseButton.setEnabled(false);
              enableConfig();
              listener.onStop();
            } else {
              stopButton.setText("Stop");
              pauseButton.setText("Pause");
              pauseButton.setEnabled(true);
              saveParams();
              listener.onRestart();
              System.out.println("restart done");
            }
          }
        });
    controlPanel.add(stopButton);

    restartButton = new JButton("Restart");
    restartButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            stopButton.setText("Stop");
            pauseButton.setText("Pause");
            pauseButton.setEnabled(true);
            saveParams();
            listener.onRestart();
          }
        });
    controlPanel.add(restartButton);

    // add text field for user input
    //		commandTextField = new JTextField();
    //		contentPane.add(commandTextField, BorderLayout.SOUTH);
    //		commandTextField.requestFocusInWindow();

    this.setVisible(true);
  }