dacase / nabc

Nonperiodic force field calculations, with a "C" language interface rather than the original interface based on the Nucleic Acid Builder (NAB) molecular manipulation language
Other
4 stars 1 forks source link

Missing config.h file necessary for compile #1

Open mmfarrugia opened 8 months ago

mmfarrugia commented 8 months ago

Hello again,

TLDR: No nabc/config.h file but nabc/src/nabc/Makefile needs it in the first line via include

I determined the best solution for my use case is likely to compile a C script which take as arguments the topology file and pdb file, then set up and run the nmodes calculation from nabc. I believe I have the code correct (included below as nabc_nmodes.c) but my C is extremely rusty so my apologies if this is all just an error in the C file. The goal would be to compile this script as a stand-alone so that it need only be called via a python subprocess call running "nabc_nmodes blah.prmtop blah.pdb" as a shell command within the python calculation methods in our code-base. My plan was to just link the necessary dependencies once compiling the whole library for ease and then create the stand-alone executable.

In order to compile this, however, I need to be able to compile the dependencies (first layer of dependencies outlined below). It looks like compilation instructions are passed down to subdirectories until nabc/src/nabc where nabc/src/nabc/Makefile has include ../../config.h in its first line but there is no config.h file at this location, producing this result:

(base) .../nabc/src/nabc$ make [NABC] make depend cc -MM axis2frame.c bonded_atoms.c deform_ener.c fd_helix.c frameutil.c getdist.c jacobi.c match.c matop.c molio.c molsurf.c molutil.c pointutil.c prm.c regexp.c select_atoms.c stringutil.c traceback.c wc_basepair.c wc_complement.c wc_helix.c > depend Makefile:1: ../../config.h: No such file or directory make: *** No rule to make target '../../config.h'. Stop.

From what I can tell, the missing file is the issue but I last worked with C at least 4 years ago and wasn't responsible for builds so thank your for your patience if this is not the case.

Direct Dependencies Note: Some of these are from nabc/src/nabc and others from nabc/src/sff so I will need to compile the latter directory as well.

nabc_nmodes.c

`#include

include

include

include

FILE* nabout;

int main(int argc, char* argv[] ) { nabout = stdout;

MOLECULE_T *m;

m = getpdb( argv[2], "");

readparm(m, argv[1]);

PARMSTRUCT_T* prm = rdparm( argv[1] );
int natm = prm->Natom;

POINT_T* x = malloc(sizeof(POINT_T) * natm);
setxyz_from_mol( &m, NULL, x );

mm_options( "cut=15., ntpr=1, nsnb=99999, diel = C, dielc = 80.40" );

// nothing frozen or constrained
int* frozen = parseMaskString( "@ZZZ", prm, (double *)x, 2 );
int* constrained = parseMaskString( "@ZZZ", prm, (double *)x, 2 );

mme_init_sff( prm, frozen, constrained, NULL, NULL );

int nm = nmode( (double *) x, prm->Nat3, mme2, 0, 0, 0.0, 0.0, 0 );
printf("nmode returns %d\n", nm);

}`

Original nab script .nab file

`molecule m; float x[4000], fret;

m = getpdb("blah.pdb"); readparm(m, "./calc/prmtop");

mm_options( "cut=15., ntpr=1, nsnb=99999, diel = C, dielc = 80.40" ); mme_init( m, NULL, "::Z", x, NULL); setxyz_from_mol( m, NULL, x );

nmode( x, 3*m.natoms, mme2, 0, 0, 0.0, 0.0, 0);`

Thank you for your time and continued support working with nabc/nab!

Mikaela Farrugia

dacase commented 8 months ago

The missing config.h file comes from not running configure. But that's because I didn't include any installations instructions...

I've made a number of updates/fixes to the repo, so please to a git pull and try again. See the README.md file for more information about how to go about using the code. For me, all the test cases work, but it won't be obvious, since they don't say PASS or FAIL explicitly. I'll try to get that fixed soon.

The NAB compiler is not made be the default make install, and is not working right now. But it looks like the fix may not be hard. I'll post a note here if/when I think things are working.

...thanks for trying this out...apologies for making you a guinea pig. Basically, this repo has been just for me, and is needlessly frustrating to outside users.

mmfarrugia commented 8 months ago

No worries at all, I'm just glad that the code is still available and maintained. I began configuring for the make following the install instructions but I notice that running ./configure with no arguments as is most common produces the message:

`configure script for nabc

current code requires either --mkl or --openblas to be set`

but providing either argument or either argument followed by a 1 doesn't change this message. I am having trouble finding generalized documentation for options which would be associated with --openblas as an argument option since ./configure --openblas produces "Option linux not recognized". Is this specific to this repo setup or is there a particular engine or file related to this that I could check for acceptable build options for openblas? If helpful, just specifying ./configure --openblas produces the same message as not including the argument.

On this note, would it be more efficient for me to place this work on the backburner for a bit and return to it once you've had time to continue your work on it or is this project not active/ongoing enough for there to be significant changes in the coming month or so?

Thank you again for your support in working with the amber force-field routines, I really appreciate your time.

Mikaela

dacase commented 8 months ago
current code requires either --mkl or --openblas to be set

This looks like you have an older version of nabc. Are you sure you have done a git pull? The latest commit is 5f33c05c48a36e02, and the above message no longer exists in configure.

Go ahead and wait for a while. I nearly have NAB itself compiling and running, which may or may not be of interest.

mmfarrugia commented 8 months ago

Ah, my mistake, I pulled on my hpc repo but not local. I do however get an issue now with a file called lex.mmo.c. I poked around a bit and it looks like it's specified by the Makefile in nabc/src/sff as both being removed during a clean and being necessary in some way I'm unfamiliar with. This is the error I get upon make install or make clean && make install: `(base) mmfarrugia@mmfarrugia-HP-Spectre-x360-Convertible:~/repos/tsff-stuff/nabc$ make install cd src && make install make[1]: Entering directory '/home/mmfarrugia/repos/tsff-stuff/nabc/src' Skipping cifparse [SFF] CC conjgrad.c [SFF] CC lmodC.c [SFF] CC memutil.c [SFF] CC nblist.c [SFF] CC newton.c [SFF] CC nmode.c [SFF] CC prm.c prm.c: In function ‘wrparm’: prm.c:2022:83: warning: embedded ‘\0’ in format [-Wformat-contains-nul] 2022 | "%%VERSION VERSION_STAMP = V0001.000 DATE = %m/%d/%y %H:%M:%S\0", | ^~

prm.c: In function ‘copyparm’: prm.c:2715:43: warning: format ‘%s’ expects argument of type ‘char ’, but argument 3 has type ‘char ()[6]’ [-Wformat=] 2715 sprintf(e_msg, "copyparm AtomNames %s", prm->AtomNames); ~^ ~~~~~~
char char ()[6]
prm.c:2726:42: warning: format ‘%s’ expects argument of type ‘char ’, but argument 3 has type ‘char ()[6]’ [-Wformat=] 2726 sprintf(e_msg, "copyparm ResNames %s", prm->ResNames); ~^ ~~~~~
char char ()[6]
prm.c:2780:42: warning: format ‘%s’ expects argument of type ‘char ’, but argument 3 has type ‘char ()[6]’ [-Wformat=] 2780 sprintf(e_msg, "copyparm AtomType %s", prm->AtomType); ~^ ~~~~~
char char ()[6]
prm.c:2786:42: warning: format ‘%s’ expects argument of type ‘char ’, but argument 3 has type ‘char ()[6]’ [-Wformat=] 2786 sprintf(e_msg, "copyparm AtomTree %s", prm->AtomTree); ~^ ~~~~~
char char ()[6]

[SFF] CC rand2.c [SFF] CC sasad.c [SFF] FLEX mm_options.l make[2]: lex: No such file or directory make[2]: [Makefile:47: lex.mmo.c] Error 127 make[1]: [Makefile:7: install] Error 2 make[1]: Leaving directory '/home/mmfarrugia/repos/tsff-stuff/nabc/src' make: *** [Makefile:4: install] Error 2 `

This is the error when just running 'make install' from the sff directory:

(base) mmfarrugia@mmfarrugia-HP-Spectre-x360-Convertible:~/repos/tsff-stuff/nabc/src/sff$ make install
[SFF]  CC conjgrad.c
[SFF]  CC lmodC.c
[SFF]  CC memutil.c
[SFF]  CC nblist.c
[SFF]  CC newton.c
[SFF]  CC nmode.c
[SFF]  CC prm.c
prm.c: In function ‘wrparm’:
prm.c:2022:83: warning: embedded ‘\0’ in format [-Wformat-contains-nul]
 2022 |    "%%VERSION  VERSION_STAMP = V0001.000  DATE = %m/%d/%y  %H:%M:%S\0",
      |                                                                    ^~

prm.c: In function ‘copyparm’:
prm.c:2715:43: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘char (*)[6]’ [-Wformat=]
 2715 |       sprintf(e_msg, "copyparm AtomNames %s", prm->AtomNames);
      |                                          ~^   ~~~~~~~~~~~~~~
      |                                           |      |
      |                                           char * char (*)[6]
prm.c:2726:42: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘char (*)[6]’ [-Wformat=]
 2726 |       sprintf(e_msg, "copyparm ResNames %s", prm->ResNames);
      |                                         ~^   ~~~~~~~~~~~~~
      |                                          |      |
      |                                          char * char (*)[6]
prm.c:2780:42: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘char (*)[6]’ [-Wformat=]
 2780 |       sprintf(e_msg, "copyparm AtomType %s", prm->AtomType);
      |                                         ~^   ~~~~~~~~~~~~~
      |                                          |      |
      |                                          char * char (*)[6]
prm.c:2786:42: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘char (*)[6]’ [-Wformat=]
 2786 |       sprintf(e_msg, "copyparm AtomTree %s", prm->AtomTree);
      |                                         ~^   ~~~~~~~~~~~~~
      |                                          |      |
      |                                          char * char (*)[6]
[SFF]  CC rand2.c
[SFF]  CC sasad.c
[SFF]  FLEX mm_options.l
make: lex: No such file or directory
make: *** [Makefile:47: lex.mmo.c] Error 127

I did a basic find search but was unable to locate a file lex.mmo.c

I will set it on the backburner then, thank you and I hope this info is helpful!

Mikaela

dacase commented 8 months ago
make: lex: No such file or directory

The script assumes that you have lex in your PATH. This is usually a pointer to flex. So, install both flex and bison from your package manager. (Configure should be checking for this and reporting an understandable error message.)

dacase commented 8 months ago

Update: I've pushed a new configure script that tests for these dependencies. It is actually looking for flex, not lex now.