# Gibbs free energy landscape

**URL:** <https://gromacs.bioexcel.eu/t/gibbs-free-energy-landscape/4888>\
**Category:** User discussions\
**Created:** [September 27, 2022, 1:54pm UTC](https://gromacs.bioexcel.eu/t/gibbs-free-energy-landscape/4888 "2022-09-27T13:54:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pallavi](https://avatars.discourse-cdn.com/v4/letter/p/3be4f8/32.png) [@Pallavi](https://gromacs.bioexcel.eu/u/Pallavi)\
**Post date:** [September 27, 2022, 1:54pm UTC](https://gromacs.bioexcel.eu/t/gibbs-free-energy-landscape/4888/1 "2022-09-27T13:54:39Z")

</div>

GROMACS version:  
GROMACS modification: Yes/No  
Here post your question  
I have formed gibbs free energy landscapes for my alone dna and dna ligand complex. The value for alone is 16.2 and for complex is 8.7. but the lower minimum energy colour is not prevent in complex. Please suggest. i have attached the landscapes for alone and complex  
Would i select the stability of complex on the basis of color or value of energy?  
also the py script is not working for 3D plots please send me the script for that for the equation  
python xpm2txt.py -f fel.xpm -o fel.txt

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/f/fad3afd90fc6eb6aa261c10e3dfe294d4bdd5443.png)  
 ![image](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/d/dcfb163f239d4abe725ce0c768a69871ff8a05bf.png)

![alone](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/e/e12bcbd690e9310656499519bc928cad1e1f69d1.png)  
 ![complex](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/a/a590961eeef1bc9bbea76a2b0caaacff7094b6a1.png)

---

<div class="post-metadata">

**Author:** ![cathrine](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/cathrine/32/1736_2.png) [@cathrine](https://gromacs.bioexcel.eu/u/cathrine)\
**Post date:** [September 29, 2022, 12:24pm UTC](https://gromacs.bioexcel.eu/t/gibbs-free-energy-landscape/4888/2 "2022-09-29T12:24:46Z")

</div>

Hi Pallavi,  
This is not a GROMACS question and I suggest you read up on free energy landscapes and statistical physics (one good book is Statistical Physics of Biomolecules by D. Zuckerman). I’m not sure where the Python script comes from, but you can surely edit it yourself to get plots in 3D. It also looks like you might need some more sampling in the second free energy plot.

---

<div class="post-metadata">

**Author:** ![Pallavi](https://avatars.discourse-cdn.com/v4/letter/p/3be4f8/32.png) [@Pallavi](https://gromacs.bioexcel.eu/u/Pallavi)\
**Post date:** [October 13, 2022, 5:54am UTC](https://gromacs.bioexcel.eu/t/gibbs-free-energy-landscape/4888/3 "2022-10-13T05:54:51Z")

</div>

@cathrine i am not able to understand your reply. Please reply in related to gromacs software.

---

<div class="post-metadata">

**Author:** ![purvak](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@purvak](https://gromacs.bioexcel.eu/u/purvak)\
**Post date:** [September 12, 2023, 11:51am UTC](https://gromacs.bioexcel.eu/t/gibbs-free-energy-landscape/4888/4 "2023-09-12T11:51:13Z")

</div>

I am pasting the script

#!/usr/bin/env python

import sys

“”"  
Utility tool to convert xpm files generated by GROMACS to a 3-column text file.  
“”"

USAGE = “USAGE: xpm2txt.py -f -o [-s]\n”  
USAGE+= “Options:\n”  
USAGE+= “\t-s\t(int)\tSorts the output by a given column”  
USAGE+= “\n” # always keep this line

# Parse arguments

read\_input, read\_output, sort = False, False, False  
xpm\_file, out\_file, column\_sort = None, None, None  
for arg in sys.argv[1:]:  
if read\_input:  
read\_input = False  
xpm\_file = arg  
elif read\_output:  
read\_output = False  
out\_file = arg  
elif sort:  
sort = False  
column\_sort = int(arg)  
if arg[0] == “-”:  
if arg == “-f”:  
read\_input = True  
continue  
elif arg == “-o”:  
read\_output = True  
continue  
elif arg == “-s”:  
sort = True  
else:  
print (USAGE)  
sys.stderr.write(‘ERROR: Option not recognized: %s\n’ %arg)  
sys.exit(1)

if not xpm\_file:  
print (USAGE)  
sys.stderr.write(‘ERROR: You forgot to provide an input file.\n’)  
sys.exit(1)  
if not out\_file:  
out\_file = “out.txt”

# Parse XPM file

xpm\_handle = open(xpm\_file)  
xpm\_data =   
x\_axis, y\_axis = ,   
letter\_to\_value = {}  
for line in xpm\_handle:  
if line.startswith(“/\* x-axis”):  
x\_axis = map(float, line.split()[2:-2]) # We trim the last value

```
if line.startswith("/* y-axis"):
    y_axis = map(float, line.split()[2:-2]) # We trim the last value

if line.startswith('"') and x_axis and y_axis: # Read data
    xpm_data.insert(0, line.strip().strip(',')[1:-1])

if line.startswith('"') and len(line.split()) > 4:
    letter = line.split()[0][1:]
    value = float(line.split()[-2][1:-1])
    letter_to_value[letter] = value

```

xpm\_handle.close()

# Match x/y/data

txt\_values =   
for y\_index, data\_value in enumerate(xpm\_data):  
y\_value = y\_axis[y\_index]  
for x\_index, x\_value in enumerate(x\_axis):  
txt\_values.append([x\_value, y\_value, letter\_to\_value[data\_value[x\_index]]])

# Apply sorting if requested

if column\_sort:  
try:  
txt\_values.sort(key=lambda x: x[column\_sort-1])  
except IndexError:  
print (USAGE)  
sys.stderr.write(‘ERROR: Column not found (%s)\n’ %(column\_sort))  
sys.exit(1)

# Print to file

out\_handle = open(out\_file, ‘w’)  
for x, y, z in txt\_values:  
out\_handle.write(“%3.5f\t%3.5f\t%3.5f\n” %(x,y,z))  
out\_handle.close()
