Surface coloring in MarvinSpace

This page shows code examples for different ways of coloring surfaces in MarvinSpace:

  1. Built-in CPK coloring

    SurfaceColoring sc = new SurfaceColoring(molecules, surface, precision);sc.doColoring(SurfaceColoring.BUILT_IN_CPK_MAPPING);

  2. Built-in residue coloring

    SurfaceColoring sc = new SurfaceColoring(molecules, surface, precision);sc.doColoring(SurfaceColoring.BUILT_IN_RESIDUE_MAPPING);

  3. Built-in chain coloring

    SurfaceColoring sc = new SurfaceColoring(molecules, surface, precision);sc.doColoring(SurfaceColoring.BUILT_IN_CHAIN_MAPPING);

  4. Coloring by parametrized built-in electrostaic potential property and built-in colors

    SurfaceColoring sc = new SurfaceColoring( molecules, surface, precision );sc.setEnrtyRadiusMode( SurfaceColoring.RADIUS_VDW_EXTENDED );surfaceColoring.setAtomRadiusExtension( 1 );sc.setPropertyValueDecreasement( SurfaceColoring.DECREASE_RECIPROCAL_SQUARE );sc.setReciprocalConstant( 8.854 );sc.setWeightMode( SurfaceColoring.SUM_OF_VALUES );sc.setBuiltInColorMapperMethod(SurfaceColoring.COLOR_MAPPER_RED_AND_BLUE);sc.setPropertyMethod( MoleculeIterators.AtomPropertyInterface.class.getMethod( "getPartialAtomCharge", new Class[] {int.class} ) );sc.doColoring();

  5. Coloring by custom atom property (of built-in MoleculeIterators.AtomPropertyInterface class) and built-in rainbow colors

    SurfaceColoring sc = new SurfaceColoring(molecules, surface, precision);sc.setWeightMode( SurfaceColoring.DISTANCE_WEIGHTED );sc.setPropertyMethod( MoleculeIterators.AtomPropertyInterface.class.getMethod( "getType", new Class[] {int.class} ) );sc.setBuiltInColorMapperMethod( SurfaceColoring.COLOR_MAPPER_RAINBOW );sc.doColoring();

  6. Coloring by custom atom property and parametrized colors

    SurfaceColoring sc = new SurfaceColoring(molecules, surface, precision);sc.setWeightMode( SurfaceColoring.DISTANCE_WEIGHTED );sc.setPropertyMethod( MoleculeIterators.AtomPropertyInterface.class.getMethod( "getType", new Class[] {int.class} ) );sc.setHomogeneousPaletteColors( new byte[][] {Colors.lightgray, Colors.yellow} );sc.doColoring();

  7. Coloring by custom property and custom colors

    chemaxon.marvin.space.util.Palette palette = new chemaxon.marvin.space.util.Palette(0, 16);palette.clear();palette.putColor( Colors.lightgray );palette.putColor( Colors.yellow );SurfaceColoring sc = new SurfaceColoring(molecules, surface, precision);sc.setWeightMode( SurfaceColoring.DISTANCE_WEIGHTED );sc.setPropertyMethod( MoleculeIterators.AtomPropertyInterface.class.getMethod( "getType", new Class[] {int.class} ) );sc.setPropertyColorMapperMethod( chemaxon.marvin.space.util.Palette.class.getMethod("getByteColor", new Class[] {double.class}) );sc.setPropertyColorObject(palette);sc.doColoring();

  8. Coloring by custom values of a custom object and built-in coloring

    SurfaceColoring sc = new SurfaceColoring( molecules, surface, precision );sc.setPropertyObject( myGrid );sc.setPropertyMethod( MyGrid.class.getMethod( "getLinearWeightedValue", new Class[] {float.class, float.class, float.class} ) );sc.setBuiltInColorMapperMethod( SurfaceColoring.COLOR_MAPPER_RAINBOW );sc.doColoring();