Skip to content

Commit

Permalink
update from devel (crest-lab#268)
Browse files Browse the repository at this point in the history
* Move one cleanup statement
* Change to csv parser

---------

Signed-off-by: Philipp Pracht <[email protected]>
  • Loading branch information
pprcht authored Feb 18, 2024
1 parent a335e5e commit 9967345
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/algos/ConfSolv.F90
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ subroutine confsolv_dump_gsoln(nall,ncol,gsoln,mapping,headers)
real(wp) :: dum
open(newunit=ich,file='confsolv.dat')
do i = 1,nall
k = mapping(i)+2
k = mapping(i)+1
write(ich,'(f15.8,1x,a)') gsoln(i),trim(headers(k))
end do
close(ich)
Expand Down Expand Up @@ -479,6 +479,7 @@ subroutine confsolv_request(ensname,nall,ncpus,gsoln,io)
!> pass the user-defined solvents-csv, or do a single solvent
if (allocated(cs_solvfile)) then
write (stdout,'(2x,a,a)') 'Requested ΔΔGsoln for solvents in ',cs_solvfile
call parse_csv_file_column(cs_solvfile,1,headers)
else
if (allocated(cs_solvent).and.allocated(cs_smiles)) then
write (stdout,'(2x,a,a,3a)') 'Requested ΔΔGsoln for ',cs_solvent,' (SMILES: ',trim(cs_smiles),')'
Expand All @@ -487,6 +488,7 @@ subroutine confsolv_request(ensname,nall,ncpus,gsoln,io)
write (stdout,'(2x,a,a,a)') 'Requested ΔΔGsoln for ',cs_solvent,' (trying to find SMILES ...)'
call cs_write_solvent_csv(cs_solvent)
end if
allocate(headers(2), source=trim(cs_solvent))
end if
write (stdout,'(2x,a,a)') 'Processing ensemble file ',trim(ensname)

Expand Down Expand Up @@ -533,9 +535,8 @@ subroutine confsolv_request(ensname,nall,ncpus,gsoln,io)
call parse_csv_allcolumns('confsolv.csv',data,cols=ncol,rows=nrow)
write (stdout,*) 'done.'
if (nrow == nall) then
allocate(mapping(nall))
if(.not.allocated(mapping)) allocate(mapping(nall))
call confsolv_select_gsoln(nall,ncol,data,gsoln,mapping)
call parse_csv_file_row('confsolv.csv',1,headers)
call confsolv_dump_gsoln(nall,ncol,gsoln,mapping,headers)
else
write (stdout,'(a)') '**ERROR** dimension mismatch in confsolv_request'
Expand Down
5 changes: 3 additions & 2 deletions src/parsing/parse_csv.f90
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ subroutine parse_csv_file_rownumber(fname,getrow,row)

if (debug) write (*,*) 'trying to get row elements',getrow
if (getrow > 0.and.getrow <= nrow) then
write(*,*) ncol,l
do i = 1,ncol
!if (debug) write(*,*) file%line(i)
row(i) = get_column_element(file%line(getrow),i)
write(*,*) trim(get_column_element(file%line(getrow),i) )
!row(i) = get_column_element(file%line(getrow),i)
if (debug) write (*,*) trim(row(i))
end do
end if
Expand Down

0 comments on commit 9967345

Please sign in to comment.