CCL Home Page
Up Directory CCL Ramble
This is a collection of C++ code for molecular modeling, intended for a
future non-Lisp version of NanoCAD. There are a few different kinds of
objects: atoms, bonds, energy/force terms, and groups. Groups are
collections of atoms with associated bond lists and term lists, for
which certain kinds of group operations are possible. At this point,
bonds are really an afterthought; eventually they will be important in
figuring out what energy/force terms ought to be.

Most everything is obvious, except for a few things:

* In the atom class, the iterate_motion method steps the equation of
motion ahead by a time step for that atom (integrates acceleration and
velocity).

* The group class has some interesting operations. select_subgroup applies
a predicate to all the atoms in a group, and all the atoms that test true
are added to another group. apply_to_atoms and apply_to_terms are useful
ways to perform a blanket operation on a group. To apply an operation to
all the atoms in a group that satisfy some predicate, create a second group
using select_subgroup, and then run apply_to_atoms on the second group.

* The group class also a method to infer bond information from interatomic
distances, but it's an order(N^2) operation so it shouldn't be done often
for large structures.

* The term class includes, in addition to traditional molecular modeling
energy terms, a "spring damper" term, which should be useful in building
lumped mechanical models to lighten computational loads.

If you put all this stuff in a library then there are some interesting things
you can do with that. One is to link it to a Lisp or Scheme or Python
interpreter, and then you have a computational chemistry engine that accepts
commands in that language (and incidentally can run any other program in that
language). Or you can link it to some kind of very simple text interface, as
I've done with the 'menu' program. It accepts scripts like this:

	atom c-sp3 0 -0.076 0 0
	atom c-sp3 0  0.076 0 0
	length 0 1
	spring-damper 0 1  2.0e4 0.3 100
	electrostatic 0 1

	every 10000
	print time
	print position 0
	print position 1
	print total-energy
	newline

	time-step 1.0e-6
	run 0 1.0

An interesting thing to do would be to write a preprocessor that scans
a PDB file and produces the 'atom' and 'term' for such scripts. The
preprocessor would do the 'setup-terms' job, and might also need to
infer hybridizations from the lengths and angles of bonds. It might
also assign charge based on the dipole moments of covalent bonds.

I've also added a shell script that uses 'menu' and 'gnuplot' to create
a graph of the distance over time between the two carbon atoms, so you
can see them oscillating. This script is called 'plot-it', and if gnuplot
is set up on your Unix box, the graph should pop up automatically.

==================================================

I've been fretting a lot over whether this should be in C or C++. I can
see good reasons for both approaches, and it's not clear which is
preferable. For the near term, I'll maintain source code in both languages
and maybe some good reason will emerge eventually for favoring one over
the other.
Modified: Tue May 20 16:00:00 1997 GMT
Page accessed 4627 times since Sat Apr 17 22:31:56 1999 GMT