Pallavi-Banerjee21 / votca

Automatically exported from code.google.com/p/votca
0 stars 0 forks source link

dlpoly topology reader (c++ part) only looks for files in current working directory #144

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Stuff like:
$ csg_stat --top path/to/.doly
won't work.

To fix that, we will have to split the directory from the filename and add it 
back to FIELD/CONFIG/HISTORY.

If we do that stuff like path/to/myHISTORY.doly still won't work.

Original issue reported on code.google.com by christop...@gmail.com on 10 Nov 2013 at 7:33

GoogleCodeExporter commented 8 years ago
This is actually an issue within the original version of the interface,
which does not allow using names other than FIELD, CONFIG and HISTORY for 
the input files. That is, there is no parameter/variable that would hold 
and bring file names from C to Fortran and backwards. 

The obvious possible solutions are:

1. I would need to introduce the corresponding parameters (fname holders)
within the interface wrapper functions; it will be still troublesome on 
the Fortran side, as I will need to amend the original DL_POLY I/O libraries
(they can only read files in the "current working directory").

2. C++ code should assume the standard DL_POLY I/O file names (see above), 
and add the path to the working directory only on the C++ side before the file 
names; this seems to be a better solution as no need to alter neither the 
interface 
(wrappers) itself, nor the DL_POLY I/O library.

Original comment by abruk...@googlemail.com on 11 Nov 2013 at 9:25

GoogleCodeExporter commented 8 years ago
To Solution 1, for the parts written in C++, which is everything except the 
parsing of FIELD, adding the directory is easy.

Solution 2 seems a bit error prone to me. If the user gives a directory VOTCA 
should tolerate that and fail if it is not implemented. Reading silently from 
the current directory is very obscure.  

Original comment by christop...@gmail.com on 11 Nov 2013 at 9:52

GoogleCodeExporter commented 8 years ago
Now I have realised that even if I change my interface to contain the path
within the fname parameter, dlpoly itself won't care about this and will
still read and write files in/to the c.w.dir. It is just the way dlpoly
works, any version.

So, it appears that we have to live with this fact, and simply keep track
of the directory in focus.

sorry for typos, if any - sent from my Andreid mobile

Original comment by abruk...@googlemail.com on 11 Nov 2013 at 10:19

GoogleCodeExporter commented 8 years ago
We don't really have to imitate the strange behaviors of dlpoly in VOTCA!

I think for now the best will be to read from cwd, but if the user explicitly 
specifies a path, which he mostly likely did for a reason, we stop with an 
error and tell it is not implemented yet.

Original comment by christop...@gmail.com on 12 Nov 2013 at 12:34

GoogleCodeExporter commented 8 years ago
I think, we should use the following logic for pure c++ parts
if basename(file) = ".dlpoly"
  open dirname(file)/{HISTORY,CONFIG}
else
  open file
fi

For the fortan interface-base parts (the topology reader) we should use:
 if file = ".dlpoly"
  open FIELD
else
  error "not implemented"
fi

Original comment by christop...@gmail.com on 12 Nov 2013 at 3:29

GoogleCodeExporter commented 8 years ago
This issue was closed by revision d083afca29ff.

Original comment by jungh...@votca.org on 12 Nov 2013 at 8:30