Skip to content

Commit

Permalink
added thin stick construction mode; introduced construction filter co…
Browse files Browse the repository at this point in the history
…ncept for MoleculeArchitect, now in ribbon/cartoon mode only shows side chains close to ligand
  • Loading branch information
thsa committed Dec 27, 2024
1 parent 318f8db commit 4023281
Show file tree
Hide file tree
Showing 20 changed files with 526 additions and 256 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public RayTraceDialog(Window parent, RayTraceOptions options, V3DMolecule mol) {
if (mol != null) {
grid.add(new Label("Render mode:"), 0, ++yIndex);
mComboboxMode = new ComboBox<>();
for (String item : MoleculeArchitect.MODE_TEXT)
for (String item : MoleculeArchitect.CONSTRUCTION_MODE_TEXT)
mComboboxMode.getItems().add(item);
mComboboxMode.getSelectionModel().select(options != null ? options.mode : mol.getConstructionMode());
grid.add(mComboboxMode, 1, yIndex);
Expand All @@ -119,14 +119,14 @@ public RayTraceDialog(Window parent, RayTraceOptions options, V3DMolecule mol) {

mComboboxSurfaceMaterial = new ComboBox[MoleculeSurfaceAlgorithm.SURFACE_TYPE.length];
for (int type=0; type<mComboboxSurfaceMaterial.length; type++) {
if (mol != null && mol.getSurfaceMode(type) != V3DMolecule.SurfaceMode.NONE) {
if (mol != null && mol.getSurfaceMode(type) != V3DMolecule.SURFACE_MODE_NONE) {
grid.add(new Label(MoleculeSurfaceAlgorithm.SURFACE_TYPE[type]+" surface material:"), 0, ++yIndex);
mComboboxSurfaceMaterial[type] = new ComboBox();
for (String item : SunflowPrimitiveBuilder.SURFACE_TEXT)
mComboboxSurfaceMaterial[type].getItems().add(item);
mComboboxSurfaceMaterial[type].getSelectionModel().select(
options != null && options.surfaceMaterial[type] != -1 ? options.surfaceMaterial[type]
: mol.getSurfaceMode(type) == V3DMolecule.SurfaceMode.WIRES ? SunflowPrimitiveBuilder.SURFACE_WIRES
: mol.getSurfaceMode(type) == V3DMolecule.SURFACE_MODE_WIRES ? SunflowPrimitiveBuilder.SURFACE_WIRES
: mol.getSurfaceTransparency(type) > 0.2 ?
SunflowPrimitiveBuilder.SURFACE_TRANSPARENT : SunflowPrimitiveBuilder.SURFACE_SHINY);
grid.add(mComboboxSurfaceMaterial[type], 1, yIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.openmolecules.fx.surface.SurfaceMesh;
import org.openmolecules.fx.surface.SurfaceTexture;
import org.openmolecules.fx.viewer3d.V3DMolecule;
import org.openmolecules.fx.viewer3d.V3DMolecule.SurfaceMode;
import org.openmolecules.fx.viewer3d.nodes.DashedRod;
import org.openmolecules.mesh.MoleculeSurfaceAlgorithm;
import org.openmolecules.render.SunflowMoleculeBuilder;
Expand Down Expand Up @@ -125,7 +124,7 @@ public void addMolecule(V3DMolecule fxmol) {

double surplus = -1;
for (int type = 0; type<MoleculeSurfaceAlgorithm.SURFACE_TYPE.length; type++)
if (fxmol.getSurfaceMode(type) != V3DMolecule.SurfaceMode.NONE)
if (fxmol.getSurfaceMode(type) != V3DMolecule.SURFACE_MODE_NONE)
surplus = Math.max(surplus, fxmol.getSurfaceMesh(type).getSurfaceSurplus());
Color color = fxmol.getColor();
mRenderer.setRenderMode(mode == -1 ? fxmol.getConstructionMode() : mode);
Expand Down Expand Up @@ -198,8 +197,8 @@ public org.sunflow.image.Color colorAtPoint(Point3 p) {
}

private int getOriginalSurfaceMaterial(V3DMolecule fxmol, int surfaceType) {
SurfaceMode surfaceMode = fxmol.getSurfaceMode(surfaceType);
if (surfaceMode == V3DMolecule.SurfaceMode.WIRES)
int surfaceMode = fxmol.getSurfaceMode(surfaceType);
if (surfaceMode == V3DMolecule.SURFACE_MODE_WIRES)
return SunflowPrimitiveBuilder.SURFACE_WIRES;
if (fxmol.getSurfaceTransparency(surfaceType) >= 0.1)
return SunflowPrimitiveBuilder.SURFACE_TRANSPARENT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class SurfaceMesh extends TriangleMesh implements MeshBuilder {
// public static final int SURFACE_COLOR_ELECTRONEGATIVITY = ?; // dummy for now
public static final int SURFACE_COLOR_DONORS_ACCEPTORS = 3; // this and above have 1D color gradient
public static final int SURFACE_COLOR_ATOMIC_NOS = 4; // this has 2D color gradients
public static final String[] SURFACE_COLOR_MODE_CODE = { "inherit", "plain", "polarity", "donorsAcceptors", "atomicNo" };

public static final boolean VERBOSE_POINTS_AND_TRIANGLES = false; // print addPoint and addTriangle

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/openmolecules/fx/tasks/V3DMinimizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private void minimize() {
for(V3DMolecule fxmol : mFXMol) {
// remove any surfaces
for (int type = 0; type<MoleculeSurfaceAlgorithm.SURFACE_TYPE.length; type++)
fxmol.setSurfaceMode(type ,V3DMolecule.SurfaceMode.NONE);
fxmol.setSurfaceMode(type ,V3DMolecule.SURFACE_MODE_NONE);

StereoMolecule mol = fxmol.getMolecule();
molScenery.addMolecule(mol);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,23 @@
package org.openmolecules.fx.tasks;

import com.actelion.research.calc.Matrix;
import com.actelion.research.chem.Canonizer;
import com.actelion.research.chem.Coordinates;
import com.actelion.research.chem.StereoMolecule;
import com.actelion.research.chem.alignment3d.transformation.Rotation;
import com.actelion.research.chem.conf.Conformer;
import com.actelion.research.chem.forcefield.ForceField;
import com.actelion.research.chem.forcefield.ForceFieldChangeListener;
import com.actelion.research.chem.forcefield.mmff.ForceFieldMMFF94;
import com.actelion.research.chem.phesa.DescriptorHandlerShape;
import com.actelion.research.chem.phesa.DescriptorHandlerShapeOneConf;
import com.actelion.research.chem.phesa.MolecularVolume;
import com.actelion.research.chem.phesa.PheSAAlignment;
import com.actelion.research.chem.phesa.PheSAMolecule;
import com.actelion.research.chem.phesa.VolumeGaussian;
import com.actelion.research.util.ArrayUtils;
import com.actelion.research.util.DoubleFormat;
import javafx.application.Platform;
import javafx.collections.ObservableList;
import javafx.geometry.Point3D;
import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.transform.Rotate;
import javafx.scene.transform.Transform;

import org.openmolecules.fx.viewer3d.CarbonAtomColorPalette;
import org.openmolecules.fx.viewer3d.V3DCustomizablePheSA;
import org.openmolecules.fx.viewer3d.V3DMolecule;
import org.openmolecules.fx.viewer3d.V3DMoleculeUpdater;
import org.openmolecules.fx.viewer3d.V3DCustomizablePheSA;
import org.openmolecules.fx.viewer3d.V3DScene;
import org.openmolecules.mesh.MoleculeSurfaceAlgorithm;

Expand Down Expand Up @@ -101,7 +89,7 @@ else if(fxmol.isSelected()) {

for(V3DMolecule v3dMol : mFitMols) {
for (int type = 0; type<MoleculeSurfaceAlgorithm.SURFACE_TYPE.length; type++)
v3dMol.setSurfaceMode(type ,V3DMolecule.SurfaceMode.NONE);
v3dMol.setSurfaceMode(type ,V3DMolecule.SURFACE_MODE_NONE);
mScene.removeMeasurements(v3dMol);
}

Expand Down
11 changes: 4 additions & 7 deletions src/main/java/org/openmolecules/fx/viewer3d/V3DBindingSite.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
import javafx.scene.Node;
import org.openmolecules.fx.surface.SurfaceMesh;
import org.openmolecules.fx.tasks.V3DMinimizer;
import org.openmolecules.fx.viewer3d.V3DMolecule.SurfaceMode;
import org.openmolecules.fx.viewer3d.nodes.NodeDetail;
import org.openmolecules.render.MoleculeArchitect;
import org.openmolecules.render.MoleculeArchitect.HydrogenMode;

import java.util.HashSet;
import java.util.List;
Expand All @@ -35,8 +33,7 @@ public enum DisplayMode {MODE1, MODE2, MODE3, MODE4};

private V3DMolecule nativeLigand;
private V3DMolecule receptor;
private MoleculeGrid grid;
private Set<Integer> bindingSiteAtoms;
private final Set<Integer> bindingSiteAtoms;
private List<V3DMolecule> solventMols;
private SimpleObjectProperty<DisplayMode> displayModeProperty;

Expand All @@ -48,8 +45,8 @@ public void initialize() {
nativeLigand.assignLikelyProtonationStates();
nativeLigand.setConstructionMode(MoleculeArchitect.CONSTRUCTION_MODE_BALL_AND_STICKS);
receptor.assignLikelyProtonationStates();
receptor.setHydrogenMode(HydrogenMode.POLAR);
grid = new MoleculeGrid(nativeLigand.getMolecule(),GRID_RESOLUTION,
receptor.setHydrogenMode(MoleculeArchitect.HYDROGEN_MODE_POLAR);
MoleculeGrid grid = new MoleculeGrid(nativeLigand.getMolecule(),GRID_RESOLUTION,
new Coordinates(GRID_DIMENSION,GRID_DIMENSION,
GRID_DIMENSION));
DockingEngine.getBindingSiteAtoms(receptor.getMolecule(), bindingSiteAtoms, grid, true);
Expand Down Expand Up @@ -88,7 +85,7 @@ private void customizeView() {
receptor.removeAllSurfaces();
nativeLigand.setConstructionMode(MoleculeArchitect.CONSTRUCTION_MODE_BALL_AND_STICKS);
receptor.setConstructionMode(MoleculeArchitect.CONSTRUCTION_MODE_STICKS);
receptor.setSurface(0, SurfaceMode.FILLED, SurfaceMesh.SURFACE_COLOR_ATOMIC_NOS, 0.5);
receptor.setSurface(0, V3DMolecule.SURFACE_MODE_FILLED, SurfaceMesh.SURFACE_COLOR_ATOMIC_NOS, 0.5);
break;
default:
receptor.removeAllSurfaces();
Expand Down
Loading

0 comments on commit 4023281

Please sign in to comment.