Grids

31 views
Skip to first unread message

schrodinger

unread,
Sep 7, 2017, 5:19:29 AM9/7/17
to Sire Users
Hello ,
I have been reading the Sire api for a while and I would be thankful if someone points me to how I can perform the following either using python api directly or the c++:
1-generating a grid around a molecule and give a value for each grid point (potential for example)
the data should be like (x,y,z,value)
2-retrieval of the value stored in the grid at a given point (x,y,z) using trilinear interpolation 

I have been experimenting with regulargrid but I didn't find a place to store values in . I am just asking cause otherwise I will have to write the routines myself and I believe it may be implemented.


BR

Christopher Woods

unread,
Sep 7, 2017, 9:21:08 AM9/7/17
to sire-...@googlegroups.com

  Hi,

Yes, what you want to do is supported in C++ in Sire. We have a GridFF2 which can quickly calculate potentials from grids, and which is integrated with the different moves and types. It is designed to be used with coulomb grids, but I believe we could adapt it easily to work with any grid data. It uses trilinear interpolation and is parallel and vectorised.

I am chairing a conference over the next couple of days so too busy to look into this more. I will take a look over the weekend or early next week.

  Best wishes,

  Christopher


--
You received this message because you are subscribed to the Google Groups "Sire Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sire-users+unsubscribe@googlegroups.com.
To post to this group, send email to sire-...@googlegroups.com.
Visit this group at https://groups.google.com/group/sire-users.
For more options, visit https://groups.google.com/d/optout.



--
---------------------------------------------------------
Christopher Woods
+44 (0) 7786 264562
http://chryswoods.com

Christopher Woods

unread,
Sep 10, 2017, 6:27:22 AM9/10/17
to sire-...@googlegroups.com

  Hi,

I've looked in more detail through the code and there are a few places to look:

(1) SireMM::GridFF2 provides a complete forcefield that uses a grid to calculate the coulomb energy of a molecule. It is one of the early grid classes that are not as well integrated with the new forcefield system. An advantage of this is that it is almost completely self-contained, with the grid potential, code to working with grids, and tri-linear interpolation all included within the class. It is very specific for coulomb energies, so would require a lot of adapting for anything else.

(2) SireMM::CLJGrid is the newer replacement for GridFF2 that integrates grids with the "new" forcefields (those based on SireMM::InterFF and SireMM::IntraFF). CLJGrid is used by InterFF and InterGroupFF to calculate the coulomb energy for fixed atoms via a coulomb grid. It is a more generic class than GridFF2, as the values of the grid points can be populate by any of the SireMM::CLJFunction-derived functions that calculate coulomb and LJ interactions. The grid is described and navigated using the SireVol::GridInfo class.

(3) SireVol::GridInfo is the class that provides metadata and navigation of a regular axis-aligned grid. This provides functions like "pointToArrayndex" that returns the index into an array for the gridpoint that is nearest the passed 3D vector in space, or "pointToGridCorners" that returns the indices of all gridpoints of the box surrounding a 3D vector in space, with, optionally, grid weights that are derived from trilinear weighting. This SireVol::GridInfo class is designed to be used with an array of values to calculate grid energies. For example, in the function "CLJGrid::total", around line 709 in SireMM/cljgrid.cpp, you will see a loop over all of the atoms, for which all atoms will be located within the grid, and grid_info.pointToGridCorners is used to find the indices of surrounding grid points and weights from trilinear interpolation. These are used to work out the potential ("phi") at each atom, which is multiplied by the charge on each atom (q[i]) to be added onto the grid energy. 

As a note, this is vectorised explicitly by using SireMaths::MultiFloat, which maps to the vector type for whatever vector scheme (SSE2, AVX, AVX-512) is available on the processor. 

I hope this is useful. Please feel free to ask more questions.

  Best wishes,

  Christopher 

p.s. SireVol::RegularGrid is an old class that was used to store grid data for writing out to Gaussian Cube data files (using SireIO::Cube). It hasn't seen much other use in Sire and is not integrated with the SireVol::GridInfo. Work is needed to link this with GridInfo and with CLJGrid etc. so that we can easily write out the grids produced by Sire.

Reply all
Reply to author
Forward
0 new messages