Re: [gmx-users] template.c

2010-06-01 Thread Chandan Choudhury
The suggestions were very helpful.
Thanks

Chandan

--
Chandan kumar Choudhury
NCL, Pune
INDIA


On Sun, May 30, 2010 at 11:32 PM, Tsjerk Wassenaar tsje...@gmail.comwrote:

 Hi Chandan,

 The problem is that with floating points the equality in

   if (fr.time == (4000.000 + (50.0 * inc)))

 is very unlikely to be satisfied at any time. To compare floating
 point numbers, you'll have to check whether the value is within a
 certain interval. But Jussi's approach is far more convenient in this
 particular case.

 Cheers,

 Tsjerk

 --
 Tsjerk A. Wassenaar, Ph.D.

 post-doctoral researcher
 Molecular Dynamics Group
 Groningen Institute for Biomolecular Research and Biotechnology
 University of Groningen
 The Netherlands
 --
 gmx-users mailing listgmx-users@gromacs.org
 http://lists.gromacs.org/mailman/listinfo/gmx-users
 Please search the archive at http://www.gromacs.org/search before posting!
 Please don't post (un)subscribe requests to the list. Use the
 www interface or send it to gmx-users-requ...@gromacs.org.
 Can't post? Read http://www.gromacs.org/mailing_lists/users.php

-- 
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.
Can't post? Read http://www.gromacs.org/mailing_lists/users.php

Re: [gmx-users] template.c

2010-05-30 Thread Jussi Lehtola
On Sun, 2010-05-30 at 21:43 +0530, Chandan Choudhury wrote:
 Hello all !!
 
 
 I want to execute the statements under if loop after each 50 ps time.


I'd just forget any if clauses in the loop and run the program with -dt
50, which gives the same result.

-- 
--
Jussi Lehtola, FM, Tohtorikoulutettava
Fysiikan laitos, Helsingin Yliopisto
jussi.leht...@helsinki.fi, p. 191 50632
--
Mr. Jussi Lehtola, M. Sc., Doctoral Student
Department of Physics, University of Helsinki, Finland
jussi.leht...@helsinki.fi
--


-- 
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.
Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] template.c

2010-05-30 Thread Tsjerk Wassenaar
Hi Chandan,

The problem is that with floating points the equality in

  if (fr.time == (4000.000 + (50.0 * inc)))

is very unlikely to be satisfied at any time. To compare floating
point numbers, you'll have to check whether the value is within a
certain interval. But Jussi's approach is far more convenient in this
particular case.

Cheers,

Tsjerk

-- 
Tsjerk A. Wassenaar, Ph.D.

post-doctoral researcher
Molecular Dynamics Group
Groningen Institute for Biomolecular Research and Biotechnology
University of Groningen
The Netherlands
--
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the
www interface or send it to gmx-users-requ...@gromacs.org.
Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] template.c

2009-09-12 Thread Justin A. Lemkul



Chih-Ying Lin wrote:


HI
To use template.c
1. create a file to put template.c and Makefile.x86_64-unknown-linux-gnu 
together

2. under C compiler
   = type the command = make -f Makefile.x86_64-unknown-linux-gnu
   = type the command = cc -O -o template template.c -lm
   = type the command = ./template  template.in http://template.in


Am I right?



No.  Read the contents of the Makefile.  The README explains how to use the 
files in the directory.


Beyond that, I would suggest some background reading about how to compile C 
code.

-Justin


Thank you
Lin





Chih-Ying Lin wrote:

 Hi
 Following are
 1.  template.c
 2.  README
 3.  Makefile.x86_64-unknown-linux-gnu


 In the template.c = it includes several GROMACS headers.
 #include statutil.h
 #include typedefs.h
 #include smalloc.h
 #include vec.h
 #include copyrite.h
 #include statutil.h
 #include tpxio.h



 If I put the GROMACS headers with template.c in the same directory, 

should I
 still need the Makefile for my architecture, intended to compile 

template.c

 and link to the GROMACS libraries correctly ???


The point of the Makefile is that you don't need to move headers around
- like it says in the README:

A Makefile.arch is created for each architecture you install
with the correct paths and libraries. You will have to link
(or copy) the correct makefile to Makefile or use the -f
option to gmake in order to select a makefile.

So do make -f Makefile.x86_64-unknown-linux-gnu like it says :-)

Mark








___
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


--


Justin A. Lemkul
Ph.D. Candidate
ICTAS Doctoral Scholar
Department of Biochemistry
Virginia Tech
Blacksburg, VA
jalemkul[at]vt.edu | (540) 231-9080
http://www.bevanlab.biochem.vt.edu/Pages/Personal/justin


___
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] template.c = put the GROMACS headers in the same file ?

2009-09-11 Thread Mark Abraham

Chih-Ying Lin wrote:

Hi
Following are
1.  template.c
2.  README
3.  Makefile.x86_64-unknown-linux-gnu


In the template.c = it includes several GROMACS headers.
#include statutil.h
#include typedefs.h
#include smalloc.h
#include vec.h
#include copyrite.h
#include statutil.h
#include tpxio.h



If I put the GROMACS headers with template.c in the same directory, should I
still need the Makefile for my architecture, intended to compile template.c
and link to the GROMACS libraries correctly ???


The point of the Makefile is that you don't need to move headers around 
- like it says in the README:


A Makefile.arch is created for each architecture you install
with the correct paths and libraries. You will have to link
(or copy) the correct makefile to Makefile or use the -f
option to gmake in order to select a makefile.

So do make -f Makefile.x86_64-unknown-linux-gnu like it says :-)

Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-users-requ...@gromacs.org.

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] template.c = put the GROMACS headers in the same file ?

2009-09-11 Thread Justin A. Lemkul



Chih-Ying Lin wrote:


Hi
Following are
1.  template.c
2.  README
3.  Makefile.x86_64-unknown-linux-gnu


In the template.c = it includes several GROMACS headers.
#include statutil.h
#include typedefs.h
#include smalloc.h
#include vec.h
#include copyrite.h
#include statutil.h
#include tpxio.h



If I put the GROMACS headers with template.c in the same directory, 
should I still need the Makefile for my architecture, intended to 
compile template.c and link to the GROMACS libraries correctly ???




You don't need to move anything.  The Makefile present in the /template 
subdirectory is sufficient to include these headers in their normal location and 
to compile the code.  This is explained in the README file.


-Justin



Thank you
Lin





= [ TEMPLATE.C ]
==
=
/*
 * $Id: template.c,v 1.5 2008/05/29 08:36:53 hess Exp $
 *
 *This source code is part of
 *
 * G   R   O   M   A   C   S
 *
 *  GROningen MAchine for Chemical Simulations
 *
 *VERSION 3.0
 *
 * Copyright (c) 1991-2001
 * BIOSON Research Institute, Dept. of Biophysical Chemistry
 * University of Groningen, The Netherlands
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * If you want to redistribute modifications, please consider that
 * scientific software is very special. Version control is crucial -
 * bugs must be traceable. We will be happy to consider code for
 * inclusion in the official distribution, but derived work must not
 * be called official GROMACS. Details are found in the README  COPYING
 * files - if they are missing, get the official version at 
www.gromacs.org http://www.gromacs.org/.

 *
 * To help us fund GROMACS development, we humbly ask that you cite
 * the papers on the package - you can find them in the top README file.
 *
 * Do check out http://www.gromacs.org http://www.gromacs.org/ , or 
mail us at grom...@gromacs.org mailto:grom...@gromacs.org .

 *
 * And Hey:
 * Gyas ROwers Mature At Cryogenic Speed
 */

/* This line is only for CVS version info */
static char *SRCID_template_c = $Id: template.c,v 1.5 2008/05/29 
08:36:53 hess

Exp $;

#include statutil.h
#include typedefs.h
#include smalloc.h
#include vec.h
#include copyrite.h
#include statutil.h
#include tpxio.h


int main(int argc,char *argv[])
{
 static char *desc[] = {
   this is a small test program meant to serve as a template ,
   when writing your own analysis tools. The advantage of ,
   using gromacs for this is that you have access to all ,
   information in the topology, and your program will be ,
   able to handle all types of coordinates and trajectory ,
   files supported by gromacs. Go ahead and try it! ,
   This test version just writes the coordinates of an ,
   arbitrary atom to standard out for each frame. You can ,
   select which atom you want to examine with the -n argument.
 };

 static int n=1;

 /* Extra arguments - but note how you always get the begin/end
  * options when running the program, without mentioning them here!
  */

 t_pargs pa[] = {
   { -n, FALSE, etINT, {n},
 Plot data for atom number n (starting on 1)
   }
 };

 t_topology top;
 intePBC;
 char   title[STRLEN];
 t_trxframe fr;
 rvec   *xtop;
 matrix box;
 intstatus;
 intflags = TRX_READ_X;

 t_filenm fnm[] = {
   { efTPS,  NULL,  NULL, ffREAD },   /* this is for the topology */
   { efTRX, -f, NULL, ffREAD }  /* and this for the trajectory */
 };

#define NFILE asize(fnm)

 CopyRight(stderr,argv[0]);

 /* This is the routine responsible for adding default options,
  * calling the X/motif interface, etc. */
 parse_common_args(argc,argv,PCA_CAN_TIME | PCA_CAN_VIEW,
   NFILE,fnm,asize(pa),pa,asize(desc),desc,0,NULL);

 /* We don't need any topology information to write the coordinates,
  * but to show how it works we start by writing the name and
  * charge of the selected atom. It returns a boolean telling us
  * whether the topology was found and could be read
  */

 read_tps_conf(ftp2fn(efTPS,NFILE,fnm),title,top,ePBC,xtop,NULL,box,TRUE);
 sfree(xtop);

 n=n-1; /* Our enumeration started on 1, but C starts from 0 */
 /* check that this atom exists */
 if(n0 || n(top.atoms.nr http://top.atoms.nr/))
 {
   printf(Error: Atom number %d is out of range.\n,n);
   exit(1);
 }

 printf(Atom name: %s\n,*(top.atoms.atomname[n]));
 printf(Atom charge: %f\n,top.atoms.atom[n].q);

 /* The first time we read data is a little special */
 read_first_frame(status,ftp2fn(efTRX,NFILE,fnm),fr,flags);

 /* This is the main loop over frames */
 do {
   /* coordinates are available in the vector fr.x
* you can find this and all other structures in
* the types directory under the 

Re: [gmx-users] template.c

2009-09-07 Thread Mark Abraham

Chih-Ying Lin wrote:

Hi :
I have difficulties to understand the following three files, which are
in Gromacs Package.
1.  template.c


This is a template you can modify to make a GROMACS utility that does 
something new and interesting.



2.  README


This is to read to help you understand.


3.  Makefile.x86_64-unknown-linux-gnu


As the README says, this is a Makefile for your architecture, intended 
to compile template.c and link to the GROMACS libraries correctly.




Please tell me if I have to do part 3 to compile template.c.


Do which part 3?

Mark


Thank you
Lin


= [ TEMPLATE.C ]
===
/*
 * $Id: template.c,v 1.5 2008/05/29 08:36:53 hess Exp $
 *
 *This source code is part of
 *
 * G   R   O   M   A   C   S
 *
 *  GROningen MAchine for Chemical Simulations
 *
 *VERSION 3.0
 *
 * Copyright (c) 1991-2001
 * BIOSON Research Institute, Dept. of Biophysical Chemistry
 * University of Groningen, The Netherlands
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * If you want to redistribute modifications, please consider that
 * scientific software is very special. Version control is crucial -
 * bugs must be traceable. We will be happy to consider code for
 * inclusion in the official distribution, but derived work must not
 * be called official GROMACS. Details are found in the README  COPYING
 * files - if they are missing, get the official version at www.gromacs.org.
 *
 * To help us fund GROMACS development, we humbly ask that you cite
 * the papers on the package - you can find them in the top README file.
 *
 * Do check out http://www.gromacs.org , or mail us at grom...@gromacs.org .
 *
 * And Hey:
 * Gyas ROwers Mature At Cryogenic Speed
 */

/* This line is only for CVS version info */
static char *SRCID_template_c = $Id: template.c,v 1.5 2008/05/29 08:36:53 hess
Exp $;

#include statutil.h
#include typedefs.h
#include smalloc.h
#include vec.h
#include copyrite.h
#include statutil.h
#include tpxio.h


int main(int argc,char *argv[])
{
  static char *desc[] = {
this is a small test program meant to serve as a template ,
when writing your own analysis tools. The advantage of ,
using gromacs for this is that you have access to all ,
information in the topology, and your program will be ,
able to handle all types of coordinates and trajectory ,
files supported by gromacs. Go ahead and try it! ,
This test version just writes the coordinates of an ,
arbitrary atom to standard out for each frame. You can ,
select which atom you want to examine with the -n argument.
  };

  static int n=1;

  /* Extra arguments - but note how you always get the begin/end
   * options when running the program, without mentioning them here!
   */

  t_pargs pa[] = {
{ -n, FALSE, etINT, {n},
  Plot data for atom number n (starting on 1)
}
  };

  t_topology top;
  intePBC;
  char   title[STRLEN];
  t_trxframe fr;
  rvec   *xtop;
  matrix box;
  intstatus;
  intflags = TRX_READ_X;

  t_filenm fnm[] = {
{ efTPS,  NULL,  NULL, ffREAD },   /* this is for the topology */
{ efTRX, -f, NULL, ffREAD }  /* and this for the trajectory */
  };

#define NFILE asize(fnm)

  CopyRight(stderr,argv[0]);

  /* This is the routine responsible for adding default options,
   * calling the X/motif interface, etc. */
  parse_common_args(argc,argv,PCA_CAN_TIME | PCA_CAN_VIEW,
NFILE,fnm,asize(pa),pa,asize(desc),desc,0,NULL);

  /* We don't need any topology information to write the coordinates,
   * but to show how it works we start by writing the name and
   * charge of the selected atom. It returns a boolean telling us
   * whether the topology was found and could be read
   */

  read_tps_conf(ftp2fn(efTPS,NFILE,fnm),title,top,ePBC,xtop,NULL,box,TRUE);
  sfree(xtop);

  n=n-1; /* Our enumeration started on 1, but C starts from 0 */
  /* check that this atom exists */
  if(n0 || n(top.atoms.nr))
  {
printf(Error: Atom number %d is out of range.\n,n);
exit(1);
  }

  printf(Atom name: %s\n,*(top.atoms.atomname[n]));
  printf(Atom charge: %f\n,top.atoms.atom[n].q);

  /* The first time we read data is a little special */
  read_first_frame(status,ftp2fn(efTRX,NFILE,fnm),fr,flags);

  /* This is the main loop over frames */
  do {
/* coordinates are available in the vector fr.x
 * you can find this and all other structures in
 * the types directory under the gromacs include dir.
 * Note how flags determines wheter to read x/v/f!
 */
printf(Coordinates at t=%8.3f : %8.5f %8.5f %8.5f\n,fr.time,fr.x[n][XX],fr
.x[n][YY],fr.x[n][ZZ]);
  } 

Re: [gmx-users] template.c

2007-06-09 Thread David van der Spoel

Pedro Alexandre de Araújo Gomes Lapido Loureiro wrote:

Thank you very much for your suggestion...
The problem is the voronoi generator program was written in C++ as a 
win32 application.
It is heavily object-oriented and to my current level of programming 
would be very hard to compile in Linux.
 
Regards.
 
Pedro.
 
I don't know anything about windows but you have to convince the 
compiler to link in the  libgmx.a library from your gromacs 
installation, and possible the libmd.a. They are in your installation 
directory under lib.




--
David.

David van der Spoel, PhD, Assoc. Prof., Molecular Biophysics group,
Dept. of Cell and Molecular Biology, Uppsala University.
Husargatan 3, Box 596,  75124 Uppsala, Sweden
phone:  46 18 471 4205  fax: 46 18 511 755
[EMAIL PROTECTED]   [EMAIL PROTECTED]   http://folding.bmc.uu.se

___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the
www interface or send it to [EMAIL PROTECTED]
Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] template.c

2007-06-08 Thread David van der Spoel

Pedro Alexandre de Araújo Gomes Lapido Loureiro wrote:

Hi,
 
I'm trying to use template.c so as to make my own analysis tool for 
gmx-generated trajectories.
Due to the complexity of the tool (it builds an affine Voronoi diagram), 
I want to compile it as a stand-alone application.
Unfortunately, the compiler cannot resolve several external functions 
called in template.c: such as thanx and read_next_frame, among others.
 
I would appreciate very much any clues in how to solve this problem.
 


rename and move template.c to src/contrib and edit Makefile.am to add 
your voronoi.c to it. then run make voronoi

Regards.
 
Pedro.





___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]

Can't post? Read http://www.gromacs.org/mailing_lists/users.php



--
David.

David van der Spoel, PhD, Assoc. Prof., Molecular Biophysics group,
Dept. of Cell and Molecular Biology, Uppsala University.
Husargatan 3, Box 596,  75124 Uppsala, Sweden
phone:  46 18 471 4205  fax: 46 18 511 755
[EMAIL PROTECTED]   [EMAIL PROTECTED]   http://folding.bmc.uu.se

___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the
www interface or send it to [EMAIL PROTECTED]
Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] template.c

2007-06-08 Thread Pedro Alexandre de Araújo Gomes Lapido Loureiro

Thank you very much for your suggestion...
The problem is the voronoi generator program was written in C++ as a win32
application.
It is heavily object-oriented and to my current level of programming would
be very hard to compile in Linux.

Regards.

Pedro.

2007/6/8, David van der Spoel [EMAIL PROTECTED]:


Pedro Alexandre de Araújo Gomes Lapido Loureiro wrote:
 Hi,

 I'm trying to use template.c so as to make my own analysis tool for
 gmx-generated trajectories.
 Due to the complexity of the tool (it builds an affine Voronoi diagram),
 I want to compile it as a stand-alone application.
 Unfortunately, the compiler cannot resolve several external functions
 called in template.c: such as thanx and read_next_frame, among
others.

 I would appreciate very much any clues in how to solve this problem.


rename and move template.c to src/contrib and edit Makefile.am to add
your voronoi.c to it. then run make voronoi
 Regards.

 Pedro.


 

 ___
 gmx-users mailing listgmx-users@gromacs.org
 http://www.gromacs.org/mailman/listinfo/gmx-users
 Please search the archive at http://www.gromacs.org/search before
posting!
 Please don't post (un)subscribe requests to the list. Use the
 www interface or send it to [EMAIL PROTECTED]
 Can't post? Read http://www.gromacs.org/mailing_lists/users.php


--
David.

David van der Spoel, PhD, Assoc. Prof., Molecular Biophysics group,
Dept. of Cell and Molecular Biology, Uppsala University.
Husargatan 3, Box 596,  75124 Uppsala, Sweden
phone:  46 18 471 4205  fax: 46 18 511 755
[EMAIL PROTECTED][EMAIL PROTECTED]   http://folding.bmc.uu.se

___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the
www interface or send it to [EMAIL PROTECTED]
Can't post? Read http://www.gromacs.org/mailing_lists/users.php

___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]
Can't post? Read http://www.gromacs.org/mailing_lists/users.php