Page 1 of 1

Problem with fortran compilation of source in github

Posted: Fri Jan 16, 2015 9:44 am
by brookscl
Dear Peter,

I pulled the github repository to build from this for testing/development of the OpenMM/CHARMM interface and find that (differing from the 6.2 release code) that there are two function names that exceed the maximum allowed in length of a function/subroutine name in fortran2003 of 63 characters, these are the functions:

OpenMM_MonteCarloAnisotropicBarostat_usesPeriodicBoundaryConditions 67 char
OpenMM_MonteCarloMembraneBarostat_usesPeriodicBoundaryConditions 64 char


This inhibits builds of any of the fortran code, because the fortran compiler chokes on OpenMMFortranModule.f90.

Is it straightforward to shorten these names?

Thanks,

Charlie

Re: Problem with fortran compilation of source in github

Posted: Fri Jan 16, 2015 11:18 am
by sherm
Hi, Charlie. A possible workaround -- your Fortran compiler may permit use of longer identifiers (though non-standard). For example, gfortran has a command line flag -fmax-identifier-length=n.

Regards,
Sherm

Re: Problem with fortran compilation of source in github

Posted: Fri Jan 16, 2015 11:44 am
by peastman
Fortran makes me sad.

How about if the Fortran wrapper just truncated the names to 63 characters? Those particular functions aren't even ones that users are likely to call.

Peter

Re: Problem with fortran compilation of source in github

Posted: Fri Jan 16, 2015 12:29 pm
by brookscl
Dear Michael and Peter,

Unfortunately, even though the option to increase the identifier length exists, it cannot go beyond 62:

Fatal Error: Maximum supported identifier length is 63

Thus, this isn't a solution. I have simply commented out those two functions in the fortran wrapper as a temporary fix, but it may be the case that the MCBarostat for membranes (which is related to what we did here, I think) will be used and needed in the future. Thus truncating the names, or commenting out the routines isn't a longer term fix. Also, as I think I noted, one cannot build the f90 examples because of this as well.

Finally, the reason I compiled this was to be able to take advantage of Peter's bug fix to the issue with the CustomCOmpoundBondForce, however, as demonstrated with the attached tar file providing a simple test that if I either of the two CustomCoumpoundBondForces I get a result (which I've verified is correct), but if I apply both at once, only one of them is computed (it happens to be the first one). I think this too is a bug, and that the two forces should be additive. Can you let me know?

Thanks,

Charlie

Re: Problem with fortran compilation of source in github

Posted: Fri Jan 16, 2015 12:45 pm
by peastman
Truncating the names wouldn't prevent you from calling them. It would just make it a little less convenient. But like I said, these aren't methods that users are actually expected to call. They exist primarily for internal use.

Peter

Re: Problem with fortran compilation of source in github

Posted: Tue Jan 20, 2015 12:45 pm
by peastman
I merged the change so it truncates function names to 63 characters. I verified that the Fortran examples now compile.

Peter