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!
Energy mismatch when identical particles belong to different types
- George Pantelopulos
- Posts: 64
- Joined: Mon Jun 01, 2015 2:15 pm
Energy mismatch when identical particles belong to different types
- Attachments
-
- Ntypes.py.txt
- (4.1 KiB) Downloaded 26 times
-
- 3types.py.txt
- (3.29 KiB) Downloaded 25 times
-
- initial.pdb.txt
- (2.56 KiB) Downloaded 26 times
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Energy mismatch when identical particles belong to different types
Here's your problem:
That should be addParticle([particle]), not addParticle().
Code: Select all
for particle in np.arange(nparticles):
system.addParticle(mass)
customNonbondedForce.addParticle([i])
- George Pantelopulos
- Posts: 64
- Joined: Mon Jun 01, 2015 2:15 pm
Re: Energy mismatch when identical particles belong to different types
Hi Peter,
What a dumb mistake! Thank you so much for checking the script for me Peter, sorry this was such a dumb question.
What a dumb mistake! Thank you so much for checking the script for me Peter, sorry this was such a dumb question.
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Energy mismatch when identical particles belong to different types
No problem. Silly mistakes like that are sometimes the hardest ones to notice!