I would like to insert a new molecule known its position, velocity and image inside the simulation box. I have tried the following two ways:
Use create_atoms command first. Then use create_bonds to connect atoms. Since create_atoms cannot create atoms positioned out of simulation box and atom image cannot be specified, when the molecule is crossing the boundary the bond length created later will be larger than half of of simulation box.
Use lmp.create_atoms(n,ids,types,x,v,image,shrinkexceed) inside python library. However it need to delete all atoms first and then recreate all with the new one, which is not very efficient if I want to constantly insert molecules.
I am wondering is there any other way to do so?
Please try defining a molecule with the molecule command from a file with all internal data set and then use create_atoms with this molecule.
I have also tried read_data append. Then I need to read the information from a file which is very slow.
Thanks for your reply.
Should I use something like:
create_atoms 0 single X Y Z mol CO2.txt rotate 1 1 1
It seems that I can only specify the position of center of a molecule and then rotate it assuming it is rigid.
However if the molecule is flexible and I want to specify the position of each individual atoms, is it possible to do that?
No, that is not possible.
I don’t see how reading from a file should slow you that much down, unless you do it very frequently, and then you are using the wrong method in the first place. Besides, there are other costs associated with changing the system that are independent of the reading part and just as time consuming.
Perhaps, rather than asking for details without context, you should first explain what your overall goal is.
I just got an idea that I can do “create_atoms 0 single” first. And then use “lmp.scatter_atoms_subset(name,type,count,ndata,ids,data)” to assign the correct position. Would this work?
Why don’t you just try and then check whether it does what you are looking for.