[MMTK] Minimization module

khinsen at cea.fr khinsen at cea.fr
Mon Nov 7 09:31:01 CET 2005


On 06.11.2005, at 06:24, vanitha at cs.wisc.edu wrote:

> I need to add a new minimization algorithm to MMTK. I'm assuming  
> that this
> would entail changes to Minimization.py, MMTK_minimization.c and a  
> total
> recompile (I installed MMTK from source). Am I right? Or is there an
> easier way to do this like recompiling just the necessary source  
> files?

These are actually two questions:

1) How best to add a minimization algorithm to MMTK.
2) How to handle compilation/installation.

Question 2) is the simpler one, so I'll answer that one first. When  
you install from source, you unpack the tar file and do "python  
setup.py build" followed by "python setup.py install", which might  
require administrator privileges. Most users would then normally  
remove the source code directory. However, if you keep it, you can  
make changes to the sources and then just redo the "build" and  
"install" steps, in which case "build" will only recompile the files  
that actually changed. There is no need to recompile everything as  
long as you don't delete the subdirectory "build" that is created by  
the build process.

As for adding a minimization algorithm to MMTK, there are several  
options. You can, as you suggest, modify Minimization.py and  
MMTK_minimization.c. This is the simplest approach if your algorithm  
is a minor modification of something already there, and if you plan  
to use it only for yourself or submit it for inclusion in the  
official distribution.

The most important alternative is to add a new Python module plus a  
new C or Pyrex module, following the model of Minimization.py and  
MMTK_minimization.py. An example of this approach (for integrators,  
but that's nearly the same) is given in Examples/LangevinDynamics.  
This is a bit more effort to set up, but the advantages of this  
approach are numerous:

1) You don't need to change the existing MMTK code, which means you  
cannot break anything there.

2) You can keep your code separate from MMTK, install it separately  
(even in a different directory), and distribute it independently, for  
example to collaborators for testing. Those users can then be sure  
that installing your add-on won't break their existing MMTK  
installation.

3) You can use tools that weren't available when I wrote the initial  
minimization code, in particular Pyrex.

You can also look at Examples/ForceFields to see how to write and  
package independent add-on modules.

Konrad.
--
------------------------------------------------------------------------ 
-------
Konrad Hinsen
Laboratoire Leon Brillouin (CEA-CNRS), CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: khinsen at cea.fr
------------------------------------------------------------------------ 
-------





More information about the mmtk mailing list