454 |
|
|
455 |
|
DUFF::DUFF(){ |
456 |
|
|
457 |
< |
char fileName[200]; |
458 |
< |
char* ffPath_env = "FORCE_PARAM_PATH"; |
459 |
< |
char* ffPath; |
460 |
< |
char temp[200]; |
457 |
> |
string fileName; |
458 |
> |
string tempString; |
459 |
|
|
460 |
|
headAtomType = NULL; |
461 |
|
currentAtomType = NULL; |
565 |
|
|
566 |
|
// generate the force file name |
567 |
|
|
568 |
< |
strcpy( fileName, "DUFF.frc" ); |
568 |
> |
fileName = "DUFF.frc"; |
569 |
|
// fprintf( stderr,"Trying to open %s\n", fileName ); |
570 |
|
|
571 |
|
// attempt to open the file in the current directory first. |
572 |
|
|
573 |
< |
frcFile = fopen( fileName, "r" ); |
573 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
574 |
|
|
575 |
|
if( frcFile == NULL ){ |
576 |
|
|
577 |
|
// next see if the force path enviorment variable is set |
578 |
< |
|
579 |
< |
ffPath = getenv( ffPath_env ); |
580 |
< |
if( ffPath == NULL ) { |
581 |
< |
STR_DEFINE(ffPath, FRC_PATH ); |
582 |
< |
} |
585 |
< |
|
586 |
< |
|
587 |
< |
strcpy( temp, ffPath ); |
588 |
< |
strcat( temp, "/" ); |
589 |
< |
strcat( temp, fileName ); |
590 |
< |
strcpy( fileName, temp ); |
591 |
< |
|
592 |
< |
frcFile = fopen( fileName, "r" ); |
578 |
> |
|
579 |
> |
tempString = ffPath + "/" + fileName; |
580 |
> |
fileName = tempString; |
581 |
> |
|
582 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
583 |
|
|
584 |
|
if( frcFile == NULL ){ |
585 |
|
|
588 |
|
"\t%s\n" |
589 |
|
"\tHave you tried setting the FORCE_PARAM_PATH environment " |
590 |
|
"variable?\n", |
591 |
< |
fileName ); |
591 |
> |
fileName.c_str() ); |
592 |
|
painCave.severity = OOPSE_ERROR; |
593 |
|
painCave.isFatal = 1; |
594 |
|
simError(); |
646 |
|
|
647 |
|
initFortran( entry_plug->useReactionField ); |
648 |
|
} |
659 |
– |
|
660 |
– |
double DUFF::getAtomTypeMass (char* atomType) { |
661 |
– |
|
662 |
– |
currentAtomType = headAtomType->find( atomType ); |
663 |
– |
if( currentAtomType == NULL ){ |
664 |
– |
sprintf( painCave.errMsg, |
665 |
– |
"AtomType error, %s not found in force file.\n", |
666 |
– |
atomType ); |
667 |
– |
painCave.isFatal = 1; |
668 |
– |
simError(); |
669 |
– |
} |
649 |
|
|
671 |
– |
return currentAtomType->mass; |
672 |
– |
} |
650 |
|
|
651 |
|
void DUFF::readParams( void ){ |
652 |
|
|
767 |
|
if( currentAtomType->name[0] != '\0' ){ |
768 |
|
|
769 |
|
if (currentAtomType->isSSD || currentAtomType->isDipole) |
770 |
< |
DirectionalAtomType* at = new DirectionalAtomType(); |
770 |
> |
at = new DirectionalAtomType(); |
771 |
|
else |
772 |
< |
AtomType* at = new AtomType(); |
772 |
> |
at = new AtomType(); |
773 |
|
|
774 |
|
if (currentAtomType->isSSD) { |
775 |
|
((DirectionalAtomType*)at)->setSticky(); |