espressomd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regarding creating more number of dimer using raspberry model


From: Jean-Noël Grad
Subject: Re: Regarding creating more number of dimer using raspberry model
Date: Thu, 10 Dec 2020 17:48:29 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:68.0) Gecko/20100101 Thunderbird/68.12.0

Dear Chandra,

It is hard to tell, because your python script is interpreted as a markup language by most email processors and gets rendered in a way that is hard to read and copy-paste in a python terminal. It would be easier for the community to help if the script was attached as a text file.

From what I understand, your for loop seems to add a particle with id=0 twice, which is not possible in ESPResSo. You can omit the argument id when calling system.part.add(), in which case ESPResSo automatically assigns a monotonically increasing id. This is the preferred way of creating particles, because the id is usually not a relevant piece of information for the user, and it can be retrieved easily from the system in the rare cases where it is relevant.

Hope this helps,
JN

On 12/10/20 2:58 PM, chandra shekhar maurya wrote:
Dear users,
I am creating a dimer and applying for a loop for creating two dimer, but I am getting an error. It may be because of id. But I am unable to fix this problem. Can anyone help me?
*The error is:*

*Exception Traceback (most recent call last) <ipython-input-5-1e08fe5a06b8> in <module> 21 print(system.box_l) 22 # Place the central particle ---> 23system.part.add(id=0, pos=colPos, type=0, q=q_col, fix=(1, 1, 1), 24 rotation=(1, 1, 1)) # Create central particle 25 print('done') particle_data.pyx in espressomd.particle_data.ParticleList.add() particle_data.pyx in espressomd.particle_data.ParticleList._place_new_particle() Exception: Particle 0 already exists.

*

*The program is:
*

system.thermostat.set_langevin(kT=0.00001, gamma=40., seed=42)

print("# Creating raspberry")
center = system.box_l / 2
colPos = center

# Charge of the colloid
q_col = -40
# Number of particles making up the raspberry (surface particles + the central particle).
#n_col_part = int(4 * np.pi * np.power(radius_col, 2) + 1)
n_col_part = int(1 + 1)

for j in range(2):
     center = np.random.randn(3)
     print(center)
     center = system.box_l/2 + center/np.linalg.norm(center)*system.box_l/2
     colPos = center
     print(center)
     print(system.box_l)
*# Place the central particle
     system.part.add(id=0, pos=colPos, type=0, q=q_col, fix=(1, 1, 1),
                 rotation=(1, 1, 1))  # Create central particle*
     print('done')
# Create surface beads uniformly distributed over the surface of the central particle
     for i in range(1, n_col_part):
         colSurfPos = np.random.randn(2)
         colSurfPos = colSurfPos / np.linalg.norm(colSurfPos) * radius_col
         print(colPos)
         colSurfPos = np.append(colSurfPos,0)
         print(colSurfPos)
         colSurfPos = colSurfPos + colPos
         print(colSurfPos)
         system.part.add(id=i, pos=colSurfPos, type=1)
         system.part[i].add_bond((col_center_surface_bond, 0))
print("# Number of colloid beads = {}".format(n_col_part))
system.force_cap = 1000
system.time_step = eq_tstep

print("Relaxation of the raspberry surface particles")
for i in range(n_cycle):
     system.integrator.run(integ_steps)

# Restore time step
system.time_step = time_step
*
*
*Your help will be highly appreciated.
*
*
*
*Thanks & Regards*
Chandra Shekhar Maurya
Mechanical Eng. Dept.
Indian Institute of Technology Patna
Contact No:9793572837




reply via email to

[Prev in Thread] Current Thread [Next in Thread]