Implementing Frames

42 views
Skip to first unread message

Emily Sprague-Klein

unread,
Apr 8, 2020, 10:17:44 PM4/8/20
to fullrmc
Hi Bachir,

I have a few questions regarding whether I incorporated the concept of frames correctly into my run.py, followed by how to plot the individual G(r) functions corresponding to each frame.  I've attached a segment of my run.py file where I've defined three frames:  normal (no constraints), with bond length and angles (EMD, BA, and B constraints), and with rotations activated (EMD, BA, and B constraints).  The script seemed to run fine, and I have three output folders in my Engine.rmc corresponding to the three different frames.  I've tried running plot.py (from the frames example) and am getting the following error message with a PDF plot that has been truncated at 5 A: 

********************************************************************************************************************************************************
runfile('C:/Users/emily/Desktop/Co cubane RMC with frames/plot.py', wdir='C:/Users/emily/Desktop/Co cubane RMC with frames')
Traceback (most recent call last):

  File "<ipython-input-6-95062b982b82>", line 1, in <module>
    runfile('C:/Users/emily/Desktop/Co cubane RMC with frames/plot.py', wdir='C:/Users/emily/Desktop/Co cubane RMC with frames')

  File "C:\Users\emily\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "C:\Users\emily\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/emily/Desktop/Co cubane RMC with frames/plot.py", line 25, in <module>
    GR.plot(ax=plt.figure().gca(), intra=False, show=False)

  File "C:\Users\emily\Anaconda3\lib\site-packages\fullrmc\Constraints\PairDistributionConstraints.py", line 1311, in plot
    **kwargs)

  File "C:\Users\emily\Anaconda3\lib\site-packages\fullrmc\Core\Constraint.py", line 1798, in plot
    titleParams  = titleParams)

  File "C:\Users\emily\Anaconda3\lib\site-packages\fullrmc\Core\Constraint.py", line 1650, in _plot
    ax.plot(shellCenters, val, INTER_STYLES[interStyleIndex], label=key, **parParams )

IndexError: list index out of range
*********************************************************************************************************************************************************

For the time being, I've commented out lines 26-30 since I'm not sure how fullrmc differentiates between my two frames for 'with bond length and angles' vs 'with rotations activated' since they both utilize the same constraints but different move_generators... 

Multiplot,py (also from the frames example) appears to work fine, however, the plot is not easy to deconvolute.  (attached)  

Any suggestions for improvement are greatly appreciated!  P.S. this is a continuation from my previous thread, I just decided to rename it with something more descriptive.  
Thanks,
Emily





partial run file.txt
multiplot.png

Peter Metz

unread,
Apr 9, 2020, 4:00:26 PM4/9/20
to fullrmc
Hi Emily,

I wrote the attached plotting function to work with a PairDistributionConstraint as input. Feel free to use or cannibalize this as you like.


If I may hazard a guess, you have a large number of constituents in your model? The hard-coded line styles in fullrmc.core.constraint.ExperimentalConstraint._plot are...

        # Create plotting styles
        COLORS  
= ["b",'g','c','y','m']
        MARKERS
= ["",'.','+','^','|']
        INTRA_STYLES
= [r[0] + r[1]for r in itertools.product(['--'], list(reversed(COLORS)))]
       
...

...which you will note is limited to 25 combinations.


@Bachir perhaps you could make your style configurations itertools.cycle instances, and call next(STYLE) to avoid this hardcoded limitation.


Cheers,
Peter

plotting.py

Bachir Aoun

unread,
Apr 9, 2020, 4:49:10 PM4/9/20
to fullrmc
Hi Emily,

The error you are having is coming as a bug fixed in newer fullrmc versions that i haven't published yet.

I think peter gave you a perfect solution that you can try out. 

When i used the set of COLORS and MARKERS i was under the impression that plotting more than 25 lines will get very cumbersome regardless of the coloring and markers ...

I will honor your request and i will make it as an option that a user can set starting from the next release

thanks   
Reply all
Reply to author
Forward
0 new messages