LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
Re: [lammps-users] LAMMPS library: Gather specific atoms and insert small molecules
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lammps-users] LAMMPS library: Gather specific atoms and insert small molecules


From: Stephan Grein <stephan.grein@...5733...>
Date: Thu, 31 Aug 2017 22:43:09 +0200

I'm apologizing for the multiple posts,
I had a problem with my mail client.

Sorry folks.

Hope somebody is still interested in my question.

Best regards,
Stephan


Am 31/08/17 um 16:46 schrieb Stephan Grein:
> Dear LAMMPS users,
> dear Steve and Axel,
> 
> I'm following up on this old post on the list.
> Trying to get all coordinates for a given
> type, e.g. 2, I put this in my LAMMPS script:
> 
> group MYGRP type 2
> variable MYCOORDS atom x
> variable MYCOUNT equal count(MYGRP)
> 
> Using the functions from library.cpp by
> 
> double* pnatoms = (double*) lammps_extract_variable(lmp, "MYCOUNT", NULL);
> int natoms = (int)(*pnatoms);
> double* coords = (double*)
> lammps_extract_variable(lmp, "MYCOORDS", "MYGRP");
> 
> However, coords contains only zeros, e.g. 0.0, 0.0, 0.0.
> Apparently I'm doing something wrong, but I'm not sure what.
> 
> Maybe somebody can point me in the right direction.
> 
> Best regards,
> Stephan
> 
> Am 13/04/16 um 17:00 schrieb Steve Plimpton:
>> Just see the variable doc page for all the syntax.
>> My email was just meant to be an idea, not
>> all the details of the correct syntax.  Ditto
>> for the lib interface function you need to use
>> to eval a variable.
>>
>> Steve
>>
>> On Tue, Apr 12, 2016 at 9:50 AM, Stephan Grein
>> <stephan.grein@...5733...
>> <mailto:stephan.grein@...5733...>> wrote:
>>
>>     Dear Steve,
>>
>>     thanks so much!
>>
>>     Am 12/04/16 um 17:27 schrieb Steve Plimpton:
>>     > variable equal x x[id][0]
>>
>>     This sounds interesting.
>>     I'm not sure how to define this
>>     in my script, sorry!
>>
>>     Would I do like that:
>>     myAtomNameToTrack equal x x[myAtomId][0]
>>
>>     Then using:
>>     lammps_extract_variable(lmp, "myAtomNameToTrack", NULL);
>>
>>     Right? TIA.
>>
>>     Best,
>>     S.
>>
>>
> 
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> 
> 
> 
> _______________________________________________
> lammps-users mailing list
> lammps-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lammps-users
> 


Attachment: signature.asc
Description: OpenPGP digital signature