Re: CCL:Reusing the NAMD code to build C++ simulation program

Dear Dr. Phillips,
 Thank you so much for your helpful advice. Now I am planning to
 rewrite a part of our C++ framework in Charm++ to replace the
 mainmodule (and main() ?) of the NAMD code with our code.
 To build a replica exchange molecular dynamics (REMD) or REM
 simulation, I have to instantiate a set of molecular modeling objects
 which return a potential energy and force vector as a function of atom
 positions. I, however, am afraid that a Tcl interpreter does not
 provide a way for creating a set of namd2 objects to which our
 framework delegates force field calculations.  Thus I am trying to
 understand which objects in the NAMD code performs the force field
 calculation and how to instantiate those objects.
 There are two points in the NAMD code which puzzle me. First, the
 main() function does not seem to be invoked in the Charm++ execution
 model, because the Charm++ programming manual says that the Charm
 Kernel starts the execution by creating a mainchare instance. The
 manual does not show any example code including a main() function so
 that I cannot see how a main() behaves in Charm++.
 The second is the calling logic for force field computation. I think
 that the Node object is responsible for all the actual calculation as
 if the functionalities of a main() function for each CPU are divided
 into its member functions. And the Sequencer object instantiated in
 the Node seems to integrate the equation of motion to update the atom
 positions and velocity vectors.  Thus, in our code, I would like to
 set the atom positions at the Patch objects in the Sequencer, to
 trigger the force field computation, and to get the resultant force
 vectors from the Patch objects.  But I cannot see which member
 function triggers the force field computation. Could you tell me which
 member function should I look into?
 It is exciting for me to look into the NAMD code and to see how its
 decomposition scheme and load balancing functionality are implemented.
 I would be very grateful for any hint or pointer to the documents for
 the NAMD implementation.
 Masakatsu Ito , Ph.D
 Grid Technology Research Center
 National Institute of Advanced Industrial Science and Technology
 Tsukuba Central 2, Tsukuba, Ibaraki 305-8568 Japan
 Phone : +81-29-861-5730  Fax : +81-29-861-5301
 E-mail masakatsu-ito^at^
 From: Jim Phillips <jim^at^>
 Subject: Re: CCL:Reusing the NAMD code to build C++ simulation program
 Date: Mon, 11 Aug 2003 16:55:18 -0500 (CDT)
 > Hi,
 > We are looking at making NAMD more modular, but it isn't there yet.  As
 > you observe, Charm++ runs through the entire control structure.  You might
 > be able to graft the entire namd2 program into your code as a single large
 > simulation object by replacing main() in mainfunc.C with your interface.
 > NAMD has a Tcl interpreter running at the top level that could maybe be
 > used to accept commands from your framework.  Otherwise, it should be
 > possible to implement REM with a small amount of network code in a NAMD
 > Tcl script (and possibly some new Tcl commands).  Good luck.
 > -Jim
 > On Sat, 9 Aug 2003 masakatsu-ito^at^ wrote:
 > > Dear Markus,
 > >
 > > Thank you for your quick reply. As you wrote, Mindy,
 > > a sequential version of NAMD, helped me a lot.
 > > It was easy to reuse and modify its code.
 > > Thus I rephrase my question. Could somebody give me an explanation
 > > if it is possible to use the NAMD code instead of the Mindy one
 > > and how to incorporate its Charm++ code into a C++ framework.
 > >
 > > From: Markus Dittrich <markus^at^>
 > > Subject: Re: CCL:Reusing the NAMD code to build C++ simulation program
 > >
 > > > Dear Masakatsu,
 > > >
 > > > The TCBG group does offer an MD code called
 > > > MINDY which is derived form NAMD source code
 > > > written solely in C++. Maybe this will be of
 > > > help to you.
 > > >
 > > >
 > > > cheers,
 > > > MARKUS
 > > >
 > > > On Fri, 8 Aug 2003 masakatsu-ito^at^ wrote:
 > > >
 > > > > Dear CCL'ers,
 > > > >
 > > > > I am wondering if it is easy to reuse the NAMD code to build
 > > > > simulation program. My question might sound strange because
 NAMD is so
 > > > > famous for its high extensibility and object-oriented design
 > > > > C++. But NAMD is actually coded in Charm++, an extended C++
 > > > > parallelization, so that the problem is that a programmer
 has to deal
 > > > > with Charm++ syntax in the NAMD code and its execution model
 > > > > parallel computation.  So, could somebody give me a brief
 > > > > how the NAMD code can be incorporated into C++ framework, or
 if it is
 > > > > possible.