[MMTK] setConfiguration -> frames are not aligned

Konrad Hinsen hinsen at cnrs-orleans.fr
Fri Apr 17 08:34:53 UTC 2009

On 16.04.2009, at 19:04, Ralf Biehl wrote:

> r_[something] is a shorthand in numpy for array(something) and  
> produces and numpy array of shape (N,3) in r_[[a.position() for a  
> in universe.atomList()]]

Then your example should work, and in fact it works for me:

In [16]: universe = InfiniteUniverse()

In [17]: universe.addObject(Molecule('water'))

In [18]: universe.addObject(Molecule('water'))

In [19]: org=universe.copyConfiguration()

In [20]: new=ParticleVector(universe, numpy.r_[[a.position() for a in  

In [21]: org+new
Out[21]: <MMTK.ParticleProperties.Configuration object at 0x2533330>

Since I use MMTK 2.5.24 as well, I wonder if the difference comes  
from somewhere else. Which versions of Python and NumPy are you using?

> As the output is an array, order of atoms should not matter

Not for getting an answer, but it does matter if you want the answer  
to make sense.

> I want to fit Small angle neutron scattering data with a standard  
> fitting routine.
> My goal was to modify the configuration  by some  small  vector  
> (for each atom) like in the energy minimization.
> The result should be a new configuration that describe my SANS data.
> Therefore i need a particleVector of the universe that gives the  
> direction for the configurational change.

If your change is a random vector, then you can in fact ignore atom  
order. But if it depends on some property of the atom, such as its  
current position, the change should better be calculated in terms of  
the ParticleVectors that MMTK already provides, to be sure to get the  
right atom order. BTW, even for random displacements, you can use  
MMTK.Random.randomParticleVector if a Gaussian distribution is fine  
for your needs.

Konrad Hinsen
Centre de Biophysique Moléculaire, CNRS Orléans
Synchrotron Soleil - Division Expériences
Saint Aubin - BP 48
91192 Gif sur Yvette Cedex, France
Tel. +33-1 69 35 97 15
E-Mail: hinsen at cnrs-orleans.fr

More information about the mmtk mailing list