Energy mismatch when identical particles belong to different types

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
George Pantelopulos
Posts: 64
Joined: Mon Jun 01, 2015 2:15 pm

Energy mismatch when identical particles belong to different types

Post by George Pantelopulos » Fri Sep 15, 2017 12:50 am

Dear all,

Currently I am trying to do something which involves setting many particles to individual types so that each particle can have unique cross-terms with other particles in a system.

However, there seems to be an issue where if I create a type for each particle, even if the cross-terms for these particles are all equal, the energy is different from if I assigned all particles of equal parameters to one type.

In the files here, OpenMM 7.1 is calculating the energy of an input configuration for the case where there are LJ particles of unique parameters "A", "B", and "C". In 3types.py A, B, and C particles are each assigned to one atom type. In Ntypes.py, A, B, and C particles are each assigned to their own type.

Epsilon and sigma parameters are assigned using a customNonbondedForce with mm.Discrete2DFunction. The initial potential energies and potential energies after minimization are very different.

Am I making some mistake? Is there some issue with how Discrete2DFunctions calculate energy?

Thank you for any insight!
Attachments
Ntypes.py.txt
(4.1 KiB) Downloaded 25 times
3types.py.txt
(3.29 KiB) Downloaded 24 times
initial.pdb.txt
(2.56 KiB) Downloaded 22 times

User avatar
Peter Eastman
Posts: 2573
Joined: Thu Aug 09, 2007 1:25 pm

Re: Energy mismatch when identical particles belong to different types

Post by Peter Eastman » Mon Sep 18, 2017 1:29 pm

Here's your problem:

Code: Select all

for particle in np.arange(nparticles):
    system.addParticle(mass)
    customNonbondedForce.addParticle([i])
That should be addParticle([particle]), not addParticle().

User avatar
George Pantelopulos
Posts: 64
Joined: Mon Jun 01, 2015 2:15 pm

Re: Energy mismatch when identical particles belong to different types

Post by George Pantelopulos » Mon Sep 18, 2017 7:28 pm

Hi Peter,

What a dumb mistake! Thank you so much for checking the script for me Peter, sorry this was such a dumb question.

User avatar
Peter Eastman
Posts: 2573
Joined: Thu Aug 09, 2007 1:25 pm

Re: Energy mismatch when identical particles belong to different types

Post by Peter Eastman » Mon Sep 18, 2017 7:44 pm

No problem. Silly mistakes like that are sometimes the hardest ones to notice!

POST REPLY