Essential Methods and Objects

The cm2membranepackingalgorithm package contains a couple of objects that have to be used and understood in order to be able to write an own membrane algorithm. This chapter will introduce you to most of these objects and their most important methods.

Be reminded that all spatial values like positions, bounds, distances etc. are measured in angstrom.

This is just an overview. For a complete documentation of the package, browse the javadoc files.


This is an extension of the class Molecule and is used for representing the lipids that you have to deal with.


This is an extension of the class Molecule and is used to represent the proteins inside the membrane


This is an abstract superclass and so it will only appear as one of its subclasses, either as a lipid or as a protein.

That means that both, lipids and proteins share the same methods.

Most important methods:


Returns the pdb-code of this molecule as a String, or null if no pdb-code was found in the file.

Point3f getPosition()

Returns the current position of the molecule.

Matrix3f getRotationMatrix()

Returns the current rotation matrix. The matrix represents the rotation of all atoms around the center of the molecule relative to the alignment they have in the original pdb file

Atom[] getAtoms()

Returns all atoms of this molecule so that you can access them. Each atom in the list will have its proper position, depending on the position and rotation of their molecule

void setRotationMatrix(Matrix3f)

Enables you to apply a new rotation to the molecule relative to its original alignment

void setPosition(Point3f)

Applies a new position to the molecule.

void rotX(float)

void rotY(float)

void rotZ(float)

These 3 methods rotate the molecule around one of its axis. For a better usability, those axis always agree with the axis of the membrane's coordinate system.


This type is used for representing an atom of a molecule. Several fields can be accessed, such as name, radius, position...

Atoms are getting interresting if you want to base your algorithm on more than geometric circumstances.


This is the superclass your algorithms inherit from. It offers a couple of useful methods:

Dimension getMembraneSize()

Returns the size of the membrane that makes up the membrane space.

Protein[] getAllProteins()

Returns a list of all proteins in the membrane

Lipid[] getAllLipids(int)

Returns a list that contains all lipids that have been added either to the extra- or to the intracellular side of the membrane. Pass the argument 0 to get all extracelular lipids, or 1 to get all intracellular lipids

Lipid createNextIntracellularLipid()

Lipid createNextExtracellularLipid()

These two methods create new lipids (either for the extra- or the intracellular side) of the next best type respecting the percental spread that the user has chosen.

void addIntracellularLipid(Lipid)

void addExtracellularLipid(Lipid)

As soon as you've found and set a proper position for your lipid, use one of these two methods in order to actually add it to the membrane. Which one you choose determines the list the lipid gets added into.

boolean intersectsBorders(Molecule)

boolean intersects(Molecule)

boolean intersectsMoleculewithMolecule(Molecule)

Intersection testing methods are a very important part of the membrane generation. They inform you wether or not an intersection between a passed molecule and either the borders or any other molecule occurs regarding the current geometric detail settings. You can test a molecule for intersection even if it not has been added to the membrane yet. You only need to set your desired position and rotation first to the molecule that is tested. There are a lot of different intersection methods available; "intersectsBorders", for example tests a molecule currently collides with a border of the membrane; "intersects" tests for any intersection between the passed molecule and any other molecules that are added to the membrane; "intersectsMoleculewithMolecule" tests two specified molecules for intersection (none of them have to be added necessarily yet).


Objects of this type are used to represent microdomains that have been defined by the user. 

Important methods:

Lipid createNextExtracellularLipid()

Lipid createNextIntracellularLipid()

These methods create new lipids of the next best type respecting the percental spread that the user chose for this microdomain


This class provides an method that helps you to display your GUI at the algorithm startup. Call

static boolean popUpGUI(Component, String title, String description)

in order to show your options panel to the user. It will appear in a dialog frame that also displays the passed title and discription. This method returns as soon as the user aprroved or cancelled; The boolean that is returned indicates the user's decision.