[gmx-users] Re: Can Gromacs functions be called by some other codes?
Mark Abraham
Mark.Abraham at anu.edu.au
Wed Jun 13 03:26:55 CEST 2012
On 13/06/2012 5:58 AM, Tsjerk Wassenaar wrote:
> Hey Kai,
>
> I would still argue that, from your description, the best solution is
> a (bash) wrapper script, containing the workflow. If you do that
> properly, it will result in a much more flexible, readable and
> maintainable solution. If you end up writing shell calls in C or
> Python, you have to sit back for a while and consider if that's really
> what you need or that you'd be better of doing shell scripting.
Indeed. C is a poor choice for gluing together functionality found in
multiple programs, unless there is a critical need for speed (e.g. the
QM-MM code) that will show enough gain to pay for the extra time spent
in development. Scripting languages are better, but still not ideal.
Shell scripts are intended to be used this way, but can lack high-level
language constructs that are convenient to use.
There is some overhead from calling grompp and mdrun to run your slave
simulation, but it is not large, and you'll have to do millions of these
calls to pay for the time spent working out how to call hacked grompp
code to construct data structures that you can feed into hacked mdrun
code at the correct point to get the output you want. What modularity is
possessed by the simulation code within GROMACS is at the "call a tool
on a command line" level only.
Mark
>
> Cheers,
>
> Tsjerk
>
>
> On Tue, Jun 12, 2012 at 9:48 PM, Da-Wei Li<lidawei at gmail.com> wrote:
>> In your own code, you should have a system call function, which can be
>> used to run any command in your system. Using C as example, you can
>> write source code like this.
>>
>> /*******************************************************/
>> system("g_rms -s xx.tpr -f xx.trr -o rmsd.xvg");
>> read in file rmsd.xvg to get the RMSD.
>>
>> if(RMSD>3A)
>> system("mdrun -s **********"");
>> else
>> printf("very good, stable MD\n");
>>
>> /*****************************************************/
>>
>> dawei
>>
>> On Tue, Jun 12, 2012 at 3:28 PM, Bao Kai<paeanball at gmail.com> wrote:
>>> Hi, Dawei,
>>>
>>> We have some other codes. Sometimes, we can not know the range of the
>>> physical parameters we need in advance. When we do the simulation, we
>>> may find some required properties are not ready, then we need to run
>>> some MD simulations to get the values of the properties. Then the
>>> simulation can continue.
>>>
>>> We want to do the MD simulations only when necessary and we want to do
>>> the MD simulations automatically.
>>>
>>> So I am wondering if we can complete some MD simulations and get the
>>> required analysis results by calling the functions inside Gromacs
>>> library.
>>>
>>> Thank you very much.
>>>
>>> Best Regards,
>>> Kai
>>>
>>>
>>> > From your description, why not just write a script to run various
>>> Gromacs programs (MD, analysis, etc)?
>>>
>>> dawei
>>>
>>> On Tue, Jun 12, 2012 at 2:43 PM, Bao Kai<paeanball at gmail.com> wrote:
>>>> Hi, all,
>>>>
>>>> I am wondering if Gromacs functions can be called by some other codes.
>>>> I know we get some library files and header files and we can write
>>>> our own analysis tools.
>>>>
>>>> But I still wonder to what extent the gromacs can be coupled to other codes.
>>>>
>>>> For example, can we just generate the topology and .gro and .mdp files
>>>> ( we can write our own code to do that ), then call the the functions
>>>> or procedures in Gromacs library to complete the MD simulation, and
>>>> then call some functions to return the analysis results, such as
>>>> density, viscosity, and etc.
>>>>
>>>> Thank you very much.
>>>>
>>>> Best Regards,
>>>> Kai
>>>> --
>>>> gmx-users mailing list gmx-users at gromacs.org
>>>> http://lists.gromacs.org/mailman/listinfo/gmx-users
>>>> Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/Search before posting!
>>>> Please don't post (un)subscribe requests to the list. Use the
>>>> www interface or send it to gmx-users-request at gromacs.org.
>>>> Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>> --
>>> gmx-users mailing list gmx-users at gromacs.org
>>> http://lists.gromacs.org/mailman/listinfo/gmx-users
>>> Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/Search before posting!
>>> Please don't post (un)subscribe requests to the list. Use the
>>> www interface or send it to gmx-users-request at gromacs.org.
>>> Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>> --
>> gmx-users mailing list gmx-users at gromacs.org
>> http://lists.gromacs.org/mailman/listinfo/gmx-users
>> Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/Search before posting!
>> Please don't post (un)subscribe requests to the list. Use the
>> www interface or send it to gmx-users-request at gromacs.org.
>> Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
>
More information about the gromacs.org_gmx-users
mailing list