[gmx-users] g_spatial Problem

Christopher Neale chris.neale at alum.utoronto.ca
Thu Oct 6 20:11:21 CEST 2016


This works for me (careful with line wrapping if this email or the list mangles it):

#!/bin/bash

PATH=/project2/p/pomes/cneale/GPC/exe/intel/gromacs-4.6.7/exec/bin:$PATH
export GMXLIB=/project2/p/pomes/cneale/GPC/exe/intel/gromacs-4.6.7/exec/share/gromacs/top

# setup variables
CENTRAL="CHO"
SDF="CHL"
top=topology.top
gro=bath_298K.part0001.gro
xtc=bath_298K.part0001.xtc

# generate a .tpr file because one was not provided in the tarball
cp itp\ files/* .
rm -f this.tpr mdout.mdp
touch empty.mdp
grompp -f empty.mdp -p $top -c $gro -o this.tpr -maxwarn 1

# make the index file
clist=$(grep $CENTRAL $gro|awk '{print $1}'|sed "s/$CENTRAL//"|uniq)
{
  for i in $clist; do
    echo "r $i"
    echo "r $i || \"$SDF\""
  done
  echo q
} > my.input
rm -f index.ndx
cat my.input | make_ndx -f $gro -o index.ndx

# create the independent segments
mkdir -p BITS
for i in $clist; do
  rm -f BITS/central_${i}.xtc
  echo -e "r_${i}\nr_${i}_${SDF}\n"| trjconv -f $xtc -s this.tpr -o BITS/central_${i}.xtc -pbc atom -center -n index.ndx
done

# join the segments
rm -f tot.xtc
trjcat -f $(for i in $clist; do echo -n "BITS/central_${i}.xtc "; done) -o tot.xtc -cat -nosort -keeplast

# create a gro for the new file type
i=$(echo $clist|head -n 1|awk '{print $1}')
rm -f onecentral.gro
echo -e "r_${i}\nr_${i}_${SDF}\n"| trjconv -f $gro -s this.tpr -o onecentral.gro -pbc mol -center -n index.ndx

# make a new .ndx file
rm -f index2.ndx
echo q | make_ndx -f onecentral.gro -o index2.ndx

# process this trajectory for fitting
rm -f tot_fitted.xtc
echo -e "${CENTRAL}\nSystem\n" | trjconv -f tot.xtc -fit rot+trans -s onecentral.gro -pbc none -n index2.ndx -o tot_fitted.xtc

## make the SDF
rm -f grid.cube
echo -e "${SDF}\n${CENTRAL}\n" | g_spatial -f tot_fitted.xtc -s onecentral.gro -nab 100

## Run VMD. Load grid.cube as isosurface and onecentral.gro to show your choline.
## Note the ability to use surface or grid representations for the isosurface. The "points" representation is kind of useless.

I will send you an image of the SDF that I generated off list.

Good luck,
Chris.
________________________________________
From: gromacs.org_gmx-users-bounces at maillist.sys.kth.se <gromacs.org_gmx-users-bounces at maillist.sys.kth.se> on behalf of Rubaiyet Abedin <abedin.r at husky.neu.edu>
Sent: 05 October 2016 15:58:14
To: gmx-users at gromacs.org
Subject: Re: [gmx-users] g_spatial Problem

Dear Dr. Neale,

Please find the following link of dropbox that contains the files.

https://www.dropbox.com/sh/ifeaegequznnbgg/AABO9AzE3PrbNtGfgMike0tWa?dl=0

Please let me know if you need anything else. I really appreciate your help.

Rubaiyet

On Wed, Oct 5, 2016 at 1:01 AM, Christopher Neale <
chris.neale at alum.utoronto.ca> wrote:

> sent a reply previously, but looks like it was lost on my end.
>
> make a tarball of .gro .top all .itp and a small .xtc (5 frames) and post
> it somewhere and put a link on this list. Add a description of which
> molecule you want for central solute and what you want to make the SDF for.
> I will then take a look and post a script to make the SDF.
>
> Chris.
>
> ________________________________________
> From: gromacs.org_gmx-users-bounces at maillist.sys.kth.se <
> gromacs.org_gmx-users-bounces at maillist.sys.kth.se> on behalf of Rubaiyet
> Abedin <abedin.r at husky.neu.edu>
> Sent: 04 October 2016 23:45:31
> To: gmx-users at gromacs.org
> Subject: Re: [gmx-users] g_spatial Problem
>
> Dear Dr. Neale,
>
> Thanks for your reply. Actually my system is quite a big system. It
> contains:
>
> Cation - 250 molecules
> Anion - 250 molecules
> Type A  (urea)- 500 molecules
> Type B (refrigerant)- 250 molecules
>
> I want to get spatial distribution function like the following. I used this
> picture as because this system is similar to mine:
> https://s26.postimg.org/hmw56k5d5/demo.jpg
>
> Let's say I am trying to get the sdf of anions around the cation (solute).
> When I am going through the manual of g_spatial, it did not specify I have
> to choose a single atom of solute. So first I took all the molecules of
> cation as a centered group and followed the steps that I mentioned in the
> earlier mail. I got something like this:
> https://s26.postimg.org/4794h3wvd/image.jpg
> If I load both grid files, it turned out like this :
> https://s26.postimg.org/hpg0te90p/image.jpg
>
> First of all it's rectangular, and all the sdf that I saw in the paper are
> spherical and in the center there are only one molecule (which is clearly
> different from mine).
>
> In the forum, I read that there should be only one centered molecule. So I
> made an index file including a random molecule of Cation and followed the
> steps. This time I got the image like this:
> https://s26.postimg.org/7gs51bacp/25percent_Copy.jpg
>
> So I am not sure what I am doing wrong. I tried to look for help. But I
> could not find any till now. Right now I am completely stuck.
>
> The process you said- to make 10 separate trajectories, in my case there
> are 250 molecules of solute and I have to do 250 analysis and then
> concatenate all the trajectories? I am not clear about this. I have
> completed my simulation, I have the  final trjectory and gro file. What you
> are suggesting is to take the trajectory and output it as 1 solute + all
> solvents (anion + type A + type B) and then concatenate all these
> trajectories.  Then run the steps that I enlisted. It is something like
> this?
>
> I am really thankful for your time.
>
> Rubaiyet
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Tue, Oct 4, 2016 at 9:44 PM, Christopher Neale <
> chris.neale at alum.utoronto.ca> wrote:
>
> > Can you please describe the system a bit more (especially how many
> > molecules of each of the 4 types you have) and also provide more
> > information about what you want to obtain (sdf, obviously, but of what
> and
> > ideally also why).
> >
> > 1. your procedure could be ok, but also maybe not. Depends on what you
> are
> > trying to achieve. I am presuming there is only 1 "anion" though (based
> on
> > the image you sent me off-list) although that doesn't jive with your
> > question #2, so I am confused here. Fitting over multiple "anion"
> molecules
> > that are separately diffusing is not likely what you want.... -- (B) the
> > grid.cube file is a rectangular matrix, so that is expected. The regions
> > with non-zero density will not fill up the entire rectangle though,
> usually.
> >
> > 2. The g_spatial program is intended for a single central fitting group.
> > There was an old program called g_sdf that may (or may not) do what you
> > want -- it was intended to look at multiple central solutes though as I
> > recall. If you want to have the cumulative sdf over all "anions" then you
> > have to do more processing. What I do in this case is this. Say I have 10
> > "anion" solute molecules (the central group for which you want to build
> an
> > sdf of other molecules around ... I'm going to call this the solute from
> > here on). Then you make 10 copies of the trajectory in which you only
> > output one solute (different one each time) and also include all the
> > solvent (this part will be the same in all trajectories). Then
> concatenate
> > all of these trajectories with trjconv -cat -nosort. You may need to
> create
> > a .tpr for this trajectory, or possibly g_spatial will accept a .gro or
> > .pdb as input to the -s option. Now you take this concatenated trajectory
> > and run it through all the steps that you listed in your email. This
> should
> > give you what you want.
> >
> > Note: if your solute is flexible, then you may not want to fit on the
> > entire solute. That may lead to smearing. I would certainly try it, but I
> > would also try fitting on different subsets of the solute (like one
> charged
> > region) that have at least 3 atoms and make that sdf as well.
> >
> > Good luck.
> > Chris.
> >
> > ________________________________________
> > From: gromacs.org_gmx-users-bounces at maillist.sys.kth.se <
> > gromacs.org_gmx-users-bounces at maillist.sys.kth.se> on behalf of Rubaiyet
> > Abedin <abedin.r at husky.neu.edu>
> > Sent: 26 September 2016 13:18:46
> > To: gromacs.org_gmx-users at maillist.sys.kth.se
> > Subject: [gmx-users] g_spatial Problem
> >
> > Dear Sir,
> >
> > Hope you are doing good. I am working with a system that contains ionic
> > liquid and refrigerant. To avoid complication let’s say my system
> contains
> > the following:
> >
> > Cation (1)
> >
> > Anion (2)
> >
> > Type A (3)
> >
> > Type B (4)
> >
> >
> >
> > And the system (0). I want to get the spatial distribution function of
> type
> > A around Anion. So the central molecule will be the anion. I used the
> > following commands:
> >
> >
> >
> > *1.      **make_ndx -f bath_298K.part0001.gro -o bath_298K_index.ndx*
> >
> >
> >
> > *2.      **trjconv -s bath_298K.tpr -f bath_298K.part0001.xtc -o
> > bath_298K_b.xtc -center  -ur compact -pbc none  -n bath_298K_index.ndx*
> >
> >
> >
> > I selected Anion (2) for centering and system (0) for output
> >
> >
> >
> > *3.      **trjconv -s bath_298K.tpr -f bath_298K_b.xtc -o bath_298K_c.xtc
> > -fit rot+trans*
> >
> >
> >
> > I selected Anion (2) for fitting and system (0) for output
> >
> >
> >
> > *4.      **g_spatial -s bath_298K.tpr -f bath_298K_c.xtc -n
> > bath_298K_index.ndx -nab 100*
> >
> >
> >
> > I selected Anion (2) to generate SDF and type A (3) to output coordinates
> >
> >
> >
> > *5.      **g_spatial -s bath_298K.tpr -f bath_298K_c.xtc -n
> > bath_298K_index.ndx -nab 100*
> >
> >
> >
> > I selected Anion (2) to generate SDF and Anion (2) to output coordinates
> >
> >
> >
> > I got two grid.cube file and load them into vmd. For the grid.cube (from
> > step 4) I chose the isosurface value 0.01 and viewed the other cube file
> as
> > a single molecule. I have several question:
> >
> >
> >
> > 1.      Do you think I am following the right procedure specially I am
> > confused and step 4 and 5. After loading both of the grid.cube file I got
> > something like this the attached.
> >
> >  For some cases I even got rectangular box. Should it be a sphere?
> >
> > 2.      I am choosing a random Anion (2). Every time I choose a different
> > anion, I see different cloud shape. I am confused if I am doing something
> > wrong or I have to choose the central molecule following any specific
> > technique.
> >
> >
> > Please help me out with this. Thanks a lot.
> >
> >
> >
> > Rubaiyet
> > --
> > Gromacs Users mailing list
> >
> > * Please search the archive at http://www.gromacs.org/
> > Support/Mailing_Lists/GMX-Users_List before posting!
> >
> > * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
> >
> > * For (un)subscribe requests visit
> > https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> > send a mail to gmx-users-request at gromacs.org.
> >
> --
> Gromacs Users mailing list
>
> * Please search the archive at http://www.gromacs.org/
> Support/Mailing_Lists/GMX-Users_List before posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> send a mail to gmx-users-request at gromacs.org.
> --
> Gromacs Users mailing list
>
> * Please search the archive at http://www.gromacs.org/
> Support/Mailing_Lists/GMX-Users_List before posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> send a mail to gmx-users-request at gromacs.org.
>
--
Gromacs Users mailing list

* Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before posting!

* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists

* For (un)subscribe requests visit
https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or send a mail to gmx-users-request at gromacs.org.


More information about the gromacs.org_gmx-users mailing list