Assigning chunks based upon clustering of molecules, not atoms

Hi everyone,

I’m using DPD with lammps to simulate amphiphilic block copolymer aggregation into micelles. To figure out which molecules belong to which micelles, I’m using the compute cluster/atom command on the hydrophobic atoms in each molecule (since I would call two clusters, with only hydrophilic sections touching, ‘different’ micelles). Ideally, I would like to be able to assign each molecule to a chunk based upon the cluster that the hydrophobic section of that molecule is assigned to (or more specifically, ALL the atoms in each molecule). However, after spending the better part of a day trying to figure out how to do this using the in-built lammps commands, I came up blank.

Is what I’m describing possible without writing my own compute/embedding python code? Ideally I wouldn’t have to do either of those (although I don’t think it would be hard to do if I had to). If you like I can describe the things I’ve tried so far.

Please let me know if I’m not making any sense or want more context.

Thanks in advance for any help,

Isaac Pincus

I don’t see a way to do this currently. I think what is needed
is a new compute that computes a per-chunk value using
operations like those in compute reduce: max, min, etc.
Call it compute reduce/chunk.

Then I think you could do what you want with 5 commands:

compute CLUSTER cluster/atom -> as you are doing it now
to assign a unique cluster ID to hphillic atoms in different mols
compute CHUNK1 chunk/atom molecule
assign each atom a chunk ID = its molecule ID
compute REDUCE reduce/chunk c_CHUNK1 max c_CLUSTER ,
this would compute a per-chunk (molecule) value = cluster

the max value of the cluster/atom assignments for atoms in the same chunk
essentially painting all atoms of molecules who share nearby hphillic
atoms in the same cluster, with the same cluster ID
compute GLOBAL global/atom c_CHUNK1 c_NEW
compute CHUNK2 chunk/atom c_GLOBAL …
use the output of GLOBAL to do a new chunk assignment

I thought there might be a way to mimic the new compute
with a vector variable and/or regular compute reduce and/or fix ave/chunk, but
I’m not seeing how to do it. Maybe someone else has an idea.

Sorry - accidentally hit send too soon … here is the complete message.

Steve

I thought there might be a way to mimic the new compute

with a vector variable and/or regular compute reduce and/or fix ave/chunk, but
I’m not seeing how to do it

This seems to me to be the problem - there’s no way to create a per-molecule global vector to store the cluster ID. I like your idea for compute reduce/chunk. I thought I could use variable python but then I realised that this can’t return a global vector either. I guess I’ll have a stab at writing my own compute.

Thanks,
Isaac