[MMTK] implementing new force field
wagner at chemie.uni-frankfurt.de
Thu Nov 8 08:59:36 UTC 2007
Hi Oliver !
I implemented a force-field for MMTK (only 1. derivates until now).
I started defining a class called MyForcefield with the method
"evaluatorTerms", that returns a list with the forcefield-terms. Here an
example for a nonbonded term:
from MMTK_forcefield import NonbondedList,NonbondedListTerm
nbl = NonbondedList(array(,Int),array(,Int), array(,Int),
universe._spec,2.8) # 2.8 =cutoff
nblUpdater = NonbondedListTerm(nbl)
from MOMO_Coulomb import CoulombTerm
For the implementation of the individual term just look at the examples
in the distribution. I took some code from nonbonded.c for the iteration
over the nonbondet list. Your "evaluatorTerms" method has to enumerate
all terms for your problem. MMTKs has handy functions to enumerate bonds
Haveing done this you may use your force-field via the setForcefield
Method of the universe class.
Olivier Delaire schrieb:
> Dear MMTK users,
> I am trying to extend the force-fields implemented in MMTK to treat the
> case of a crystal vibrating around its equilibrium configuration. The
> type of force-field I want to implement would be an expansion of the
> energy in terms of small displacements of nuclei from their equilibrium
> sites (Taylor-type expansion).
> If I expand the energy up to 2nd order in the nuclear coordinates, then
> I should get quadratic on-site terms corresponding to 'Einstein
> ocsillators', and already implemented as one of the harmonicFF examples
> in the distribution. Besides the on-site terms, one should also get the
> cross-terms u_i x u_j , where u_i is the displacement amplitude for atom
> i (here in 1D).
> Now, I would want to implement such a force-field up to higher orders
> (say 3 or 4), and of course I would have to restrict the range of each
> type of interaction in order not have so many free parameters.
> I have been looking in to the Python and C force-field classes, but
> these are rather intimidating. Presently, it seems to me that the
> nonbonded.c file could be extended to treat that kind of force-field,
> but I am unsure wether assumptions in other places in the package will
> break if I try to modify it... Also, I am not entirely sure wether I
> should start with the 'bonded' or 'nonbonded' types of force fields.
> Does anyone have any experience in implementing new force-fields for
> MMTK? Where should I start?
> Your help is greatly appreciated.
More information about the mmtk