espressomd-users
[Top][All Lists]
Advanced

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

Re: [ESPResSo] How to fill simulation box with copies of complex molecul


From: Marek Maly
Subject: Re: [ESPResSo] How to fill simulation box with copies of complex molecule which was read in from file ?
Date: Mon, 19 Apr 2010 21:42:55 +0200
User-agent: Opera Mail/10.10 (Win32)

Dear all,
thank you very much for your responses !

Below is code which might be used for loading of the given molecular structure and for it's replication within the simulation box (including bonds). The structure is written in "onedendrimer.txt" which has common Espresso formating and contain just positions of the individual particles and bonds. There are just two important variables "n_den" (total number of molecules which should be placed into box) and "n_part_one_den" (number of particles per one molecule - here small dendrimer). For those who are interested I attached whole script "DPD_dendrimers" for the full DPD simulation of dendrimers in solvent including file with dendrimer structure "onedendrimer.txt", modified
header file "soft_sphere.h" (to implement standard DPD potential).

I also attached my animation script "vmd_animate.tcl" which works with PSF/PDB files generated during simulation. Unfortunately I am not able to visualise in resonable way the system in foleded mode (inside the simulation box). I already posted this problem on VMD mailing forum but didn't get
any response till now. Please see:

http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/15670.html

I would really appreciated if anybody can help here. I hope that someone
from Espresso community already solved this problem.

Best wishes,

    Marek


#Here we are loading the dendrimer structure which is saved in the file "onedendrimer.txt"
set in [open "onedendrimer.txt" "r"]
while { [blockfile $in read auto] != "eof" } {}
close $in


#shift the loaded molecule so that the particle id=0 has coordinates 0 0 0 (not necessary for calculations but better for visualisations)

#obtain the coordinates of the particle 0
 set x0 [lindex [part 0 print pos] 0]
 set y0 [lindex [part 0 print pos] 1]
 set z0 [lindex [part 0 print pos] 2]

for {set i 0} {$i<$n_part_one_den} {incr i} {
        
        #obtain the coordinates of the particle i
         set x [lindex [part $i print pos] 0]
         set y [lindex [part $i print pos] 1]
         set z [lindex [part $i print pos] 2]
        
        #shift of the i-th particle of the loaded dendrimer structure
        part $i pos [expr $x-$x0 ] [expr $y-$y0 ] [expr $z-$z0 ]
        
}

#create and place into the simul box the rest of the ( n_den - 1 ) the dendrimers

#loop over the number of the new dendrimers
for {set i 1} {$i<$n_den} {incr i} {
        
        
#generate the shift of the new dendrimer regarding to original one within the range of the simul box
        set shiftx [expr $box_l*[t_random]]
    set shifty [expr $box_l*[t_random]]
    set shiftz [expr $box_l*[t_random]]

#create i-th dendrimer from the "$n_part_one_den". j is going over the beads of the loaded dendrimer.
for {set j 0} {$j<$n_part_one_den} {incr j} {
        
        #obtain the coordinates of the particle j
         set x [lindex [part $j print pos] 0]
         set y [lindex [part $j print pos] 1]
         set z [lindex [part $j print pos] 2]
        #obtain the type of the particle i
        set i_type [part $j print type]

#create j-th DPD particle of the i-th dendrimer (just shifted copy of the corresponding DPD particle in the loaded dendrimer) part [expr $j + $i*$n_part_one_den ] pos [expr $x + $shiftx ] [expr $y + $shifty ] [expr $z + $shiftz ] type $i_type
        
}
#end for j
        

}
#end of creating dendrimer beads

#copy the bonds from the loaded dendrimer to all the new ones
for {set i 0} {$i<$n_part_one_den} {incr i} {
        
        #get the list of indexes of particles connected with particle i
#this is one component list of type { {} {} {} {} {} }. Index of this component is 0
        set connected_with_i [part $i print connections]
        #this is list of components of above one component list {} {} {} {} {}
        set connected_with_i [lindex $connected_with_i 0]
        
        #number of bonded neighbors to particle i
        set nobn [llength $connected_with_i ]
        
        for { set j 0} {$j< $nobn} {incr j} {
                
                set id_connected_particle   [lindex $connected_with_i $j]
                
                for { set k 1 } {$k< $n_den} {incr k} {
                        
#Bond between particle with higher index (id) and particle with lower index is registered in particle with higher index if { [part $i print id] > [lindex $connected_with_i $j] } {part [expr $i+$k*$n_part_one_den] bond 0 [expr $id_connected_particle+$k*$n_part_one_den] } if { [part $i print id] < [lindex $connected_with_i $j] } {part [expr $id_connected_particle+$k*$n_part_one_den] bond 0 [ expr $i+$k*$n_part_one_den] }
                        
                
                }
                #end k
        
        }
        #end j
        
}
#end i

#END OF BUILDINNG OF THE DENDRIMERS (resp. DENDRIMER DPD PARTICLES)














Dne Mon, 12 Apr 2010 15:09:13 +0200 Marek Maly <address@hidden> napsal/-a:

Dear Axel,

thank you very much.

I will do some "copy" function when I have little time (in few days)
and send it to all.

Best,

      Marek





Dne Sun, 11 Apr 2010 13:11:49 +0200 Axel Arnold <address@hidden> napsal/-a:

On Sunday 11 April 2010, Marek Maly wrote:
Dear all,

let say that I prepare external block file with the structure (positions,
covalent bonds, types of particles) of
one complex molecule X (let say specific hyperbranched polymer).

If I use the right block format I should have no problems to load this one
molecule into espresso using
blockfile command.

But let say that I want to put into simulation box several of such
molecules not just one.

What is the best way how to do it in actual version of the Espreso ?

Is there for example some COPY command which is able to copy whole
molecule X
INCLUDING BONDS and put it in some shifted position in simul. box ?

If one does not care about the bonds, it is very trivial task.
Also copying of the bonds should not be not so big problem
just using "part $i print connections" to learn connectivity
of the particles of original molecule and create the same connections in particles which belong to new molecule. But OK, this approach is possible but if there already exist some simple COPY function which is capable to
create
copy of the original molecule (including all relevant properties for
example all, potentials (bond, angle, dihedral) )
I would really prefer it.

Hi!

Not that I am aware of. At least when I was writing our benchmark scripts, I
did the copying manually... You can of course write a corresponding Tcl
function and post it back, then we can include it in the distribution if
someone needs such a copy function in the future.

Cheers,
Axel





--
Tato zpráva byla vytvořena převratným poštovním klientem Opery: http://www.opera.com/mail/

Attachment: vmd_animate.tcl
Description: Tcl script

Attachment: DPD_dendrimers.tcl
Description: Tcl script

Attachment: onedendrimer.txt
Description: Text document

Attachment: soft_sphere.h
Description: Binary data


reply via email to

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