Open BartBruininks opened 1 year ago
I think this got discussed some time ago (as in, a few years ago), but I can't find the associated issue. IIRC the main problem is that finding the included file is annoyingly complicated which is why we put it off originally. The included files can either be absolute path, local (but it's ambiguous whether it's local to the ITP file being read or the current working directory), or a file somewhere in GMX_DIR (env var, forgot the name).
If this is an important feature for you fixing it yourself and opening a PR will be by far the fastest :)
The itp reader does not resolve #includes
at all and the reason is that they are in fact rarely used in itp files. The Go model is really the only exception. At the time we did not bother because it raised some other questions like do we parse #defines and how to deal with these paragmas. The new Go model implementation also completely gets rid of the include files.
If you are interested to read an itp file with #includes try the polyply topology parser as shown below. FYI you need a topology file, which means you at least need to define the [molecules]
directive at the end of the file.
from polyply.src.topology import Topology
topology = Topology.from_gmx_topfile(name=name, path=toppath)
Hoi,
I would say if we don't want to fix it. We could change the error. If there is an #include in the itp, it could be stated that this is not supported and the data should be explicitly present.
Op do 19 okt. 2023 18:13 schreef Fabian Grunewald @.***
:
The itp reader does not resolve #includes at all and the reason is that they are in fact rarely used in itp files. The Go model is really the only exception. At the time we did not bother because it raised some other questions like do we parse #defines and how to deal with these paragmas. The new Go model implementation also completely gets rid of the include files.
If you are interested to read an itp file with #includes try the polyply topology parser as shown below. FYI you need a topology file, which means you at least need to define the [molecules] directive at the end of the file.
from polyply.src.topology import Topology topology = Topology.from_gmx_topfile(name=name, path=toppath)
— Reply to this email directly, view it on GitHub https://github.com/marrink-lab/vermouth-martinize/issues/554#issuecomment-1771195761, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALLQB7YOLNBCVQPMZ4ULGDYAE7TBAVCNFSM6AAAAAA6G47AVWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZRGE4TKNZWGE . You are receiving this because you authored the thread.Message ID: @.***>
Hoi,
It seems like the ITP reader cannot handle nested includes in the included itps in the top file. This is used (a lot) in Go models and in any case is valid syntax. This issue is resolved if the content of the file which is included is copy pasted into the itp (instead of importing it). Therefore I am pretty certain it is a parsing error.
Cheers,
Bart