[MMTK] external fields

Richard Graham richard at rdg.cc
Thu Aug 29 21:22:20 UTC 2013

Hi Konrad.

Thanks for your quick response.

I am still struggling in understanding how everything works and was
wondering if you could clear up some things for me and check if my
understanding is correct.

The documentation and examples are great for an overall abstract picture
and ok at the level of the existing class methods. But at the interface
level, when I want to know 'what do I need to do to implement a force
field', it is a bit more difficult. Also I can't see any details about
the class instance variables in the documentation, only the methods.

By my understanding, basically what I need to do is write a new
forcefield representing my trapping potential. I will add this to one of
the built in force fields and do a molecular dynamics simulation. The
force field is something with an evaluatorTerms method that returns
something with an evaluate method. This method will need to go through
everything in the given universe and work out the force based on its
position. This then somehow goes in the results dict.

Do you have any description of the keys required in the results dict
returned by evaluate? As far as I can tell I should only need to output
the forces. Is this possible?

Do you have any standard interface for the integrator 'actions' objects?

I noticed that when creating an atom, it seems to get an average mass of
all the isotopes. If seems like it would be better for the atom to have
a randomly selected isotope weighted by the natural abundances when created.


On 08/28/2013 12:30 AM, Konrad Hinsen wrote:
> --On 27 août 2013 14:33:11 -0700 Richard Graham <richard at rdg.cc> wrote:
>> I am intending to add an external trapping field to a universe, so
>> basically I need to be able to write a function to calculate a
>> force/charge vector as a function of position. Seems like that should
>> not be to difficult..
>> I would appreciate if anyone could point me in the right direction.
> MMTK has no built-in force field term for external fields, but MMTK was
> designed to make it easy to add new force field terms.
> The best starting point for your problem is the "ElectricField" example,
> which is in the MMTK source code distribution
> (Examples/Forcefields/ElectricField). There are three implementations
> (Python, Cython, C), which are equivalent in effect but differ in
> convenience of coding and in performance. You should probably start with
> the Python version, which is the most straightforward one. If you need
> better performance, move on to the Cython version. The C version is of
> interest only if you want to integrate existing C code into an MMTK
> force field, and even then I'd rather use Cython nowadays.
> Konrad.

More information about the mmtk mailing list