Hi,
I can provide the wrapper code in full since it is a self-contained module, but in general most of the code deals with converting the MC's code's atomistic information into a format that get_energy in predict.f90 can understand.
call initialize_lib(str1, str2, indata)
I call the "initialize" function from AENet in the constructor function which gets called during the simulation initialization so it is called once at the start of the simulation. The only major changes I have made to the AENet code is making it so it beings reading from the second input file on the command line instead of the first to avoid having it read the MC code's input script and also added the _lib extension to routine names to avoid a name space conflict. However, this loads just fine since I was able to get the same energy as the predict executable for a single configuration case. The actual energy calculation lines are similar to what is found in predict.f90.
boxrecp(:,:) = geo_recip_lattice(box)
tempcoords(1:3,1:nCurAtoms) = matmul(boxrecp, tempcoords)/(2.0E0_dp*pi)
call get_energy(box, nCurAtoms, tempcoords(1:3, 1:nCurAtoms), atomTypes(1:nCurAtoms), pbc, Ecoh, E_T)
Outside of that the remaining code deals mainly Monte Carlo code's formatting and I have double checked to ensure the information being passed is consistent with the information predict.f90 would receive. The problem occurs when an actual simulation run is attempted.
I did use -O3 -xHost so I can try with -O2. In my experience the line at 353 error occurs when Intel Fortran encounters a segmentation fault earlier in the code and it modifies the next array or item in memory. GFortran is less likely to do this. Intel Fortran can be picky about how unallocated arrays are passed.
I tried to check to ensure I wasn't missing a function call, but it seemed like most of the other function calls in predict.f90 were related to I/O or Parallelization.
Any insight would be great, thanks.
-Troy