From 8daefd1d57ffab91d3c0b86dc844679a8601f074 Mon Sep 17 00:00:00 2001
From: Marc DeGraef <degraef@cmu.edu>
Date: Wed, 10 Apr 2024 18:11:46 -0400
Subject: [PATCH] sets crystal file status to readonly when structure data is
 read

---
 Source/EMsoftOOLib/mod_crystallography.f90 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Source/EMsoftOOLib/mod_crystallography.f90 b/Source/EMsoftOOLib/mod_crystallography.f90
index b877f44..c899349 100644
--- a/Source/EMsoftOOLib/mod_crystallography.f90
+++ b/Source/EMsoftOOLib/mod_crystallography.f90
@@ -2631,7 +2631,10 @@ recursive subroutine readDataHDF_(self, SG, EMsoft, useHDF, useXtalName)
 else
   xtalname = trim(EMsoft%generateFilePath('EMXtalFolderpathname',self%xtalname))
 end if
-hdferr =  me%openFile(xtalname)
+! we use the readonly optional parameter to make sure that HDF does not lock
+! the file; this could cause conflicts if multiple program simultaneously try to 
+! acces the same crystal structure file  [MDG, 4/10/24]
+hdferr =  me%openFile(xtalname, readonly=.TRUE.)
 
 groupname = SC_CrystalData
 hdferr = me%openGroup(groupname)
@@ -2753,8 +2756,6 @@ recursive subroutine readDataHDF_(self, SG, EMsoft, useHDF, useXtalName)
 ! space groups, so this needs to remain at .FALSE. always.
 call SG%setSpaceGroupsecond(.FALSE.)
 
-! if (openHDFfile) call me%closer()
-
 end subroutine readDataHDF_
 
 !--------------------------------------------------------------------------