[gmx-developers] Where is do_func() defined in the code (for mdp read in, I think)

Jochen Hub jhub at gwdg.de
Fri Oct 31 10:58:15 CET 2008


Mark Abraham wrote:
> Jochen Hub wrote:
>> chris.neale at utoronto.ca wrote:
>>> Hello,
>>>
>>> I am working my way through the gromacs code with gmx-4.0 and I have a
>>> question about how information is read in from the .mdp file.
>>>
>>> I find do_inputrec() in tpxio.c, which calls do_int() or do_real(), etc.
>>> These appear to be special cases of do_func() as defined in
>>> include/gmxfio.h
>>>
>>> However, I can not find the meat of do_func() anywhere in the src or
>>> include directories.
>>
>> In such cases I usually use:
>>
>> find . -name "*.[hc]" -exec grep do_func {} \; -print
> 
> Nice one. I have a perl script for the same purpose...
> 
> #!/usr/bin/perl -w
> use strict;
> 
> my $grepfiles = join(' ', split(/\n/, `ls src/*/*.[ch] include/*.h
> include/*/*.h src/gmxlib/nonbonded/nb_kernel*/*.[ch]
> src/gmxlib/nonbonded/*.[ch]`));
> 
> foreach my $text ( @ARGV ) {
>     print `grep '$text' $grepfiles`;
> }
> 
> Your "find" idiom is more elegant. My approach allows for multiple
> search keys supplied on the command line. If I ever encountered a more
> complex need, I'd make it handle regexps too!

For regextp and multiple keys you may also use egrep (grep -E)

find . -name "*.[hc]" -exec egrep 'do_func|do_other_func' {} \; -print

But hey, aliasing that line is indeed a good idea. For the bash you may
 place

findsource() { find . -name "*.[hc]" -exec egrep "$@" {} \; -print; }

(which actually defines a function) in the .alias and use

findsource "do_func|gmx_editconf"

Happy source search!

Jochen


> 
> Mark
> _______________________________________________
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the www
> interface or send it to gmx-developers-request at gromacs.org.
> 
> .
> 


-- 
************************************************
Dr. Jochen Hub
Max Planck Institute for Biophysical Chemistry
Computational biomolecular dynamics group
Am Fassberg 11
D-37077 Goettingen, Germany
Email: jhub[at]gwdg.de
Tel.: +49 (0)551 201-2312
************************************************



More information about the gromacs.org_gmx-developers mailing list