Invalid order for directive atomtypes (error)

If your ligand topologies both introduce new atom types (or any other force field parameters), you have to collect them and declare those directives before any [moleculetype] can be introduced. The entire force field has to be complete before any molecules can be defined. See the Error FAQ page for more information.