[Top][All Lists]

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

Re: [ESPResSo-users] Coarse Grained Multi sided particles.

From: Peter Košovan
Subject: Re: [ESPResSo-users] Coarse Grained Multi sided particles.
Date: Fri, 19 Jun 2015 15:18:04 +0200

Hi Rohit,

"too many open files" appears, because your files never get closed. There is a missing close bracket in                    
if { $btitle == "particles"}   {
                              puts "frame_no $j pmax $pmax"
so the code is executed differently than your indentation suggests. I recommend using a text editor which shows you matching brackets to prevent such problems.

For good reasons there is no such thing as interactions of "halves" and "quarters" of particles. By definiotion, particle is the smallest building block. If your object is more complex, you should build it from several particles, bonds, virtual sites, constraints, etc.

Btw: calculating MSD the way you implemented it is very inefficient and gets double inefficient if implemented in TCL. Might be a good idea to check the correlator in the user guide and correlation.tcl in the samples directory.



On Fri, Jun 19, 2015 at 1:02 PM, Rohit Goswami <address@hidden> wrote:
I was wondering if espresso has any way of defining separate interactions for different portions (say halves or quarters) of a single particle. Additionally, the rdf calculation from multiple configuration files failes for more than 1005 files; would this be a tcl limitation or an espresso limitation?
The code for the rdf calculation is

                set out [open "$::datadir/msd_$type.dat" "w"]
                set origin 0
                puts $out "#"
                puts $out "#"
                puts $out "# Mean Square Deviation From Warmup Configurations"
                puts $out "#"
                puts $out "#"
                set cnt 0
                set pmax [setmd max_part]
                set j 0
                while {$j<$::warm_n_times} {
                puts -nonewline "j is $j \r"
                set in [open "$::warmconfdir/config_$j" "r"]
                set f [open "$::warmconfdir/config_$j" "r"]
                while { [blockfile $f read auto] != "eof" } {}
                close $f

                while {  [set btitle [ blockfile $in read auto] ] != "eof" } {
                        set msd 0.0;
                        if { $btitle == "particles"}   {
                                puts "frame_no $j pmax $pmax"
                        if {$j == 1} {
                                for {set i 0} {$i < $pmax} {incr i} {
                                set pos [part $i print pos]
                       lappend vec_r0 $pos
                 if {$j > 1} {
                        for {set i 0} {$i < $pmax} {incr i} {
                                set pos [part $i print pos]
                                set pos0 [lindex $vec_r0 $i]
                                set delta_r [vecsub  $pos $pos0]
                        puts "delta_r $delta_r"
                                set msd [expr $msd + [veclensqr $delta_r] ]
                                set msd [expr $msd/$pmax]
                                puts $out "$j  $msd"
                                close $in
                                incr j
            close $out

While the configurations are written every integration step by

set f [open "$::warmconfdir/config_$::i" w]
            blockfile $f write tclvariable {box_length density}
            blockfile $f write variable box
            blockfile $f write particles {id pos type}
            flush $f
            close $f

Dr. Peter Košovan

Department of Physical and Macromolecular Chemistry
Faculty of Science, Charles University in Prague, Czech Republic

Katedra fyzikální a makromolekulární chemie
Přírodovědecká fakulta Univerzity Karlovy v Praze
Tel. +420221951290
Fax +420224919752

Pokud je tento e-mail součástí obchodního jednání, Přírodovědecká fakulta Univerzity Karlovy v Praze:
a) si vyhrazuje právo jednání kdykoliv ukončit a to i bez uvedení důvodu,
b) stanovuje, že smlouva musí mít písemnou formu,
c) vylučuje přijetí nabídky s dodatkem či odchylkou,
d) stanovuje, že smlouva je uzavřena teprve výslovným dosažením shody na všech náležitostech smlouvy.

reply via email to

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