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: Steve Plimpton <sjplimp@...24...>
Date: Thu, 5 Oct 2017 13:39:55 -0600

There is no LAMMPS command that will tell
you the current # of molecules.  Since molecule IDs
do not need to be contiguous, I can't think of a simple
way to calculate it.  E.g. by a compute.

You could use compute reduce to calculate the max or
min molecule ID.  Which means you could assign the
result to a variable and invoke the variable via
the lib interface, e.g. lammps_command() or
lammps_extract_variable().  If you figure out
how to count unique molecule IDs (in parallel), you could
write it yourself external to LAMMPS and call
extract_atom() thru the lib interface to get pointer
(on each proc) to the mol IDs.

Steve


On Mon, Sep 25, 2017 at 4:17 PM, Stephan Grein <stephan.grein@...5733...> wrote:
Addendum: I would also be willing to implement
a library function for that purposes.

Best wishes,
Stephan

Am 25/09/17 um 00:22 schrieb Stephan Grein:
> Hey Steve,
>
> I'm defining my group as follows:
> Determine the first index (by looking at the dump) of
> my molecule of interest and calculate last index by:
> last index = first index + nMols.
> (nMols I know because I added e.g. nMols = 3 molecules).
>
> Then I can form a group.
> I found out that this question has been asked
> on the mailing list (archive) but I could not
> find an answer. That's why I politely ask again:
>
> How can I get the total number of molecules
> in my simulation box (Preferably by a call to
> lammps_command)? Thanks in advance.
>
> Best wishes,
> Stephan
>
> Am 22/09/17 um 16:51 schrieb Steve Plimpton:
>> I suggest you dump a snapshot and see what
>> the molecule IDs are of the atoms you added.
>>
>> Steve
>>
>> On Thu, Sep 21, 2017 at 2:15 PM, Stephan Grein
>> <stephan.grein@...1064...106...frankfurt.de
>> <mailto:stephan.grein@...7107...uni-frankfurt.de>> wrote:
>>
>>     Dear LAMMPS users,
>>
>>     let me rephrase my previous post to be more precise.
>>     I read in a protein structure by and added
>>     after that three molecules randomly by:
>>     read_data       main_protein.data
>>     molecule        1 small_protein.data
>>     create_atoms    1 random 3 1506024437 NULL mol 1 91731
>>
>>     Then, I want to retrieve the atoms of the three inserted
>>     molecules (which have a total of 19 atoms each) by:
>>     group MYGRP molecule <> 1 3
>>
>>     This will however not give me 57 atoms (3*19 atoms):
>>     48 atoms in group MYGRP
>>
>>     I think I'm missing a piece of information
>>     (Or more likely doing something wrong...)
>>
>>     Thanks in advance.
>>
>>     Best regards,
>>     Stephan
>>
>>
>>     Am 19/09/17 um 23:45 schrieb Stephan Grein:
>>     > I think I will go with that...
>>     >
>>     > Am 19/09/17 um 19:22 schrieb Axel Kohlmeyer:
>>     >> but in my opinion, it is not worth the hassle. i would just set up
>>     >> everything assuming no overlap of types and then script that
>>     process. it
>>     >> seems much easier and simpler to me.
>>     >>
>>     >
>>     > I managed to set up my force field, though, now I
>>     > inserted by create_atoms my molecules randomly.
>>     >
>>     > Is it correct to use (if my molecule has ID 1)
>>     > "group MYGRP molecule 1" to get all the replicated
>>     > molecules in my box?
>>     >
>>     > Because then I could use the code you gave me
>>     > in a previous answer to extract all coordinates
>>     > from these molecules by:
>>     >
>>     > lammps_command(lmp,"variable MYCOORDSX atom x");
>>     >                                                                   
>>                                                                        
>>                                                                        
>>                            double *coordsX = (double
>>     > *)lammps_extract_variable(lmp, "MYCOORDSX","MYGRP");
>>     >
>>     > This seems not to give me all x-coordinates
>>     > (I replicated 3 molecules with 19 atoms but
>>     > I'm getting only 6 x-coordinates.)
>>     >
>>     > Thanks in advance.
>>     >
>>     > Best regards,
>>     > Stephan
>>     >
>>     >
>>     >
>>     >
>>     > ------------------------------------------------------------------------------
>>     > 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@...396...sourceforge.net
>>     <mailto:lammps-users@...396...sourceforge.net>
>>     > https://lists.sourceforge.net/lists/listinfo/lammps-users
>>     <https://lists.sourceforge.net/lists/listinfo/lammps-users>
>>     >
>>
>>
>>     ------------------------------------------------------------------------------
>>     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@...396...sourceforge.net
>>     <mailto:lammps-users@...396...sourceforge.net>
>>     https://lists.sourceforge.net/lists/listinfo/lammps-users
>>     <https://lists.sourceforge.net/lists/listinfo/lammps-users>
>>
>>
>
> -
>
>
>
> ------------------------------------------------------------------------------
> 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@...12...396...sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lammps-users
>


------------------------------------------------------------------------------
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@...6297....sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lammps-users