Periodic Box Dimensions - OpenMM

73 views
Skip to first unread message

Gaetano Calabrò

unread,
Mar 12, 2012, 1:58:36 PM3/12/12
to Sire Developers
Hello,

I'm trying to extend Sire to perform MD simulations using OpenMM. I've
called the OpenMM API to perform the Monte Carlo Barostat algorithm.
I'd like to update the box dimensions using the
AtomicVelocityWorkspace. I need to pass back the new box dimensions
to Sire. I was able to do it in Python using the Sire-Python wrappers:

space = system.property(“space”)
space.setDimensions(Vector(a,b,c))
system.setProperty(“space”,space)

I'm not completely sure that this is the best solution in Python. I
tried to implement something similar in c++ without success. Can you
help me please?

Kind Regards,

Gaetano

Christopher Woods

unread,
Mar 15, 2012, 9:11:43 PM3/15/12
to sire-de...@googlegroups.com
Dear Gaetano,

You are updating the space in the right way. It has to be done via the
"system.setProperty" call, as this will correctly notify the other
objects in the system that the space property has changed. You can do
the same thing in C++ by calling;

PeriodicBox space = system.property("space").asA<PeriodicBox>();
space.setDimensions( Vector(a,b,c) );
system.setProperty("space", space);

As you can see, in C++ there is no implicit casting, so you have to
explicitly cast the returned property to the type you want
(PeriodicBox in this case, I think).

Best wishes,

Christopher

Reply all
Reply to author
Forward
0 new messages