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

From: yjcoshc (yjcoshc_at_gmail.com)
Date: Wed Dec 05 2018 - 19:45:11 CST

Hello Faramarz,

If you really need Cartesian coordinates of ALL atoms in the simulation,
you can create a copy of your pdb input file to refatoms.pdb and mark
the occupancy column with 2.0 for all atoms and use

cartesian {

     atoms {

         atomsFile refatoms.pdb

         atomsCol O

         atomsColvalue 2.0

     }

}

in your colvars input file. For the calculation based on these
coordinates, you can use either the scriptedFunction or customFunction
(more in
http://colvars.github.io/colvars-refman-namd/colvars-refman-namd.html).

Then again, requesting coordinates of all atoms may greatly slow down
the simulation, so actually we only mark the atoms we need in the atomsFile.

Regards,

Haochuan Chen

在 2018/12/6 上午8:39, Faramarz Joodaki 写道:
> Dear Haochuan,
>
> Thank you again for your guidance and sorry for my late response!
>
> Yes, NAMD can save dv evey step. I think for this parameter, I am
> going to save them and then apply my calculation on them.
>
> I have a question about colvars module. If covalrs module have an
> access to all coordinated of atoms, how can I apply my calculation on
> them?
>
> Best Regards,
> Faramarz
>
> On Tue, Nov 27, 2018 at 8:44 PM yjcoshc <yjcoshc_at_gmail.com
> <mailto:yjcoshc_at_gmail.com>> wrote:
>
> 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 : Mon Dec 31 2018 - 23:21:34 CST