Page 2 of 3

Re: Print dipol vectors

Posted: Thu Oct 24, 2013 6:56 pm
by peastman
Oops - there was a bug in the Python wrapper for that method. I've just checked in a fix, so it works correctly now.

In C++ that argument is used for output, but Python uses a return value instead. So just call multipoleForce.getInducedDipoles(context), and the return value will be a list of Vec3s.

Peter

Re: Print dipol vectors

Posted: Fri Oct 25, 2013 5:08 am
by michaelschauperl
Hi again.
Thanks for fixing the bug.
I have another questions concerning simulations with amoeba and pbc. At the start of every simulation i got a lot of warning like this:

/opt/rh/python27/root/usr/lib64/python2.7/site-packages/simtk/openmm/app/internal/pdbstructure.py:504: UserWarning: WARNING: duplicate atom (HETATM 127 H HOH 42 6.507 1.147 6.368 1.00 0.00 H , HETATM 126 H HOH 42 6.297 2.417 7.165 1.00 0.00 H )
warnings.warn("WARNING: duplicate atom (%s, %s)" % (atom, old_atom._pdb_string(old_atom.serial_number, atom.alternate_location_indicator)))
/opt/rh/python27/root/usr/lib64/python2.7/site-packages/simtk/openmm/app/internal/pdbstructure.py:504: UserWarning: WARNING: duplicate atom (HETATM 130 H HOH 43 0.458 4.812 -1.472 1.00 0.00 H , HETATM 129 H HOH 43 0.023 5.814 -2.520 1.00 0.00 H )
warnings.warn("WARNING: duplicate atom (%s, %s)" % (atom, old_atom._pdb_string(old_atom.serial_number, atom.alternate_location_indicator)))

I think the program is only shifting atoms, but i dont see a reason for it. So could you explain why OpenMM is doing that? And is it something to worry about or can i neglect it.

Thanks again,

michael

Michael

Re: Print dipol vectors

Posted: Wed Oct 30, 2013 2:06 pm
by peastman
Hi Michael,

It's hard to be sure without actually seeing your file, but that does look like something is wrong with it. Here is my best guess: your file uses the same name (H) for both hydrogens in a water molecule. That's invalid: every atom in a residue is required to have a unique name. In the case of a water molecule, they should be called H1 and H2. PdbStructure can't tell whether these are supposed to be two atoms, and you incorrectly used the same name for both, or whether they are supposed to be two locations for the same atom, and you forgot to include the alternate location indicator.

Peter

Re: Print dipol vectors

Posted: Tue Mar 11, 2014 5:55 am
by michaelschauperl
Hi all,

I have once more a question related to this topic. I am quite sure but I wanted to double check. The unit of the induced dipol is proton charge * nanometer?

And if i read out my induced dipols the first 3 numbers belong to the first atom in my inputfile? And the same is true for coordinates?
So the first 3 numbers in my dipol file represent the dipol vector of the first atom in my inputfile and the first 3 number in my coordinates file represents the coordinates of the first atom? Or is the order of the atoms changed during the simulation?

And the third questions is: " Is there a python command to read out the permanent dipol moments on each atom in the orientation of the coordination system of the simulation, in other words the current dipol vector"

Thanks for a quick response.

Michael

Re: Print dipol vectors

Posted: Wed Mar 12, 2014 4:14 pm
by leeping
Hi Michael,

The getInducedDipoles() function returns the induced dipole in OpenMM native units, that is elementary charge * nanometer. I'm 95% sure of this as I read the source code, though I haven't used it myself.

There's a different function called getSystemMultipoleMoments() which gives you the total charge, dipole, and quadrupole of the entire simulation in the lab frame. Those are in the TINKER-compatible units, i.e. debye for dipoles and debye*Angstrom for quadrupoles.

I am quite sure the components are returned in the way you described as it wouldn't really make sense otherwise. Are you getting answers that suggest the atoms are being reordered in your output?

I don't think there is a function for getting the lab frame permanent dipoles although I think it could be easily implemented. Is it something you need?

Thanks,

- Lee-Ping

Re: Print dipol vectors

Posted: Thu Mar 13, 2014 5:25 am
by michaelschauperl
Hi Lee Ping,

Thanks for the answer.

charge*nanometer make totally sense. I just wanted to doublecheck.

I was a bit wondered by the results at a first glance and thought something is wrong, but i am now pretty convinced that the results are reasonible.
I just wanted to get sure, as this was the only mistake I could have thought about.

Yes I would like to calculate the overall dipol moment of a whole molecule and for that it would be nice to read out the permanent dipols. The only way I could implemented this feature by myself is by reading out the coordinates after the simulation and add the dipols then then but I was hoping that there is an easier way?

Michael

Re: Print dipol vectors

Posted: Thu Mar 13, 2014 8:27 am
by leeping
Hi Michael,

You can add this feature request to the official tracker and one of us will implement it. Or if you would like, you may try your hand at some development and implement this feature yourself. I'm a novice developer compared to Peter, but here is a rough overview of what would need to be done:

0) Fork the repository on Github.

1) Create the API for your function, which I think would be called getLabFramePermanentDipoles() or something similar. It would go in plugins/amoeba/openmmapi/include/openmm/AmoebaMultipoleForce.h and plugins/amoeba/openmmapi/include/openmm/internal/AmoebaMultipoleForceImpl.h. I am still not sure why OpenMM has Forces and ForceImpls, maybe Peter could explain this one.

2) Implement the function on the Reference platform. You may use ReferenceCalcAmoebaMultipoleForceKernel::getInducedDipoles() as a reference. It is at line 686 in https://github.com/SimTk/openmm/blob/ma ... ernels.cpp .

3) Implement it on the CUDA platform. You may use CudaCalcAmoebaMultipoleForceKernel::getInducedDipoles() as a reference, it is at line 1643 in plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp. Note the labFrameDipoles->download() function gives you the permanent dipoles in the lab frame, in the same unit system (elementary charge * nanometer) as the induced dipoles.

4) Write unit tests to make sure your code is behaving properly. You can probably copy one of the existing unit tests and use a known result from a TINKER calculation.

5) Submit pull request on Github. :)

Again, this is just an option for you, and perhaps it could serve as a reference for people who might want to do some development.

Thanks,

- Lee-Ping

Re: Print dipol vectors

Posted: Thu Mar 13, 2014 10:18 am
by peastman
And before you do any of that, read the OpenMM Developer Guide! It explains the whole architecture, and things like why we have both Forces and ForceImpls.

Peter

Re: Print dipol vectors

Posted: Wed Dec 09, 2015 3:59 pm
by saurabhbelsare
Hi,

Has this function to get the permanent dipoles rotated in the lab frame been implemented?

Thanks.

Saurabh

Re: Print dipol vectors

Posted: Wed Dec 09, 2015 4:14 pm
by peastman
The function discussed above has been implemented. But it returns the induced dipoles, not the permanent ones.

Peter