Re: How to add a C code to NAMD properly?

From: yjcoshc (yjcoshc_at_gmail.com)
Date: Tue Nov 27 2018 - 19:44:25 CST

Hello Faramarz,

As far as I know, the aMD's dV is not collected to the colvars module.
Maybe you want to use your own histogram code and the dV to reweight the
trajectory on the fly. Actually I have tried to modify the NAMD's code
to make it working with the histogram in colvars:

1. Export dV from NAMD's TCL interface and implement a getaMDWeight TCL
command to get the dV in the NAMD configuration file every step;

2. Modify the histogram bias in colvars to make it accept the weight on
the fly (the weight can be set by calling cv bias histo1 reweight w);

3. Modify the NAMD configuration accordingly.

In this way I have to set stepspercycle to 1 and use a TCL loop with
"run 1" to reweight the histogram on the fly, so it's rather slow.

A faster way may be to collect the dV to colvars module through the C++
interface (NAMD's GlobalMaster) directly. The NAMD's code, however, are
rather undocumented and currently I don't work on it.

If you have some better ideas please let me know.

Thanks,

Haochuan Chen

在 2018/11/28 上午6:10, Faramarz Joodaki 写道:
> Dear Haochuan and Jerome,
>
> Thank you for your response and guidance!
>
> My calculation will not be expensive and I need all all atom
> coordinates and some calculate properties by NAMD such as dv in the
> accelerated MD. I will check colvars module.
>
> Best Regards,
> Faramarz
>
> On Mon, Nov 26, 2018 at 7:27 AM Jérôme Hénin <jerome.henin_at_ibpc.fr
> <mailto:jerome.henin_at_ibpc.fr>> wrote:
>
> To add to Haochuan's remark: the best way to do it will vastly
> depend on what you are calculating, and what it depends on:
> positions? velocities? forces? few atoms, many atoms, all atoms?
> box size? pressure?  Is it an expensive calculation? Do you need
> to parallelize it?
>
> Jerome
>
> On Sun, 25 Nov 2018 at 02:25, yjcoshc <yjcoshc_at_gmail.com
> <mailto:yjcoshc_at_gmail.com>> wrote:
>
> Hi Faramarz,
>
> If you only require the atomic coordinates and the current
> step, you can
> utilize the colvars module. The usage can be found in the NAMD
> manual.
>
> Regards,
>
> Haochuan Chen
>
>
> 在 2018/11/24 上午2:58, Faramarz Joodaki 写道:
> > Hi everyone!
> >
> > I would like to do some calculations on trajectory for each
> step of a
> > MD simulation. It is a long MD simulation so saving all
> steps in dcd
> > file is impossible.
> > Hence, I need to add some codes to the source code of NAMD to
> > calculate some properties during MD simulations (Runtime). I
> was
> > wondering if there is a proper way to do that. Actually, I
> can go
> > inside the source code and change or add my C code but I am
> looking
> > for an efficient way to do that such as linking my code to
> the source
> > code of NAMD. I would be so grateful if you could guide me
> with this
> > matter.
> >
> > Best Regards,
> > Faramarz
>

This archive was generated by hypermail 2.1.6 : Sat Dec 07 2019 - 23:20:18 CST